Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-698

Ensure _cbson can encode types with broken __getattr__ implementations

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.1, 3.0
    • Affects Version/s: 2.7
    • Component/s: None
    • None

      The changes in PyMongo 2.7 to better support python sub-interpreters (mainly mod_wsgi) with PyMongo's C extensions interact poorly with python types from third party libraries that have broken implementations of __getattr__. In these cases a call to PyObject_HasAttrString will always return 1, with PyObject_GetAttrString returning an unexpected value. _cbson already handles the unexpected value, but in a way that makes it impossible to encode types that can still be encoded, regardless of their broken __getattr__ implementation. This isn't technically a bug in PyMongo, but we should work around it anyway.

      This issue was reported in https://github.com/mongodb/mongo-python-driver/pull/234.

      Thanks to Sergey Azovskov for the report and patch.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: