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

Ensure _cbson can encode types with broken __getattr__ implementations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • 2.7
    • 2.7.1, 3.0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: