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
    • Labels:

      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.

            bernie@mongodb.com Bernie Hackett
            bernie@mongodb.com Bernie Hackett
            0 Vote for this issue
            2 Start watching this issue