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

BSON C module directly accesses private attributes.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.8
    • Fix Version/s: 3.9
    • Component/s: BSON
    • Labels:
      None
    • Environment:
      Any
    • Backwards Compatibility:
      Fully Compatible

      Description

      In cbsonmodule.c under the case 7 (ObjectID) switch, a call is made to PyObject_GetAttrString(value, "_ObjectIdid") instead of PyBytes_AsString requesting Python cast the ObjectId value to a byte string. Interestingly, it does use PyBytes immediately after retrieval of the private attribute. By utilizing that private (mangled) attribute, it requires extremely ugly hacks in any datatype one attempts to write that must be compatible. Please consider implementing bytes within ObjectId (it's curiously missing despite str_ being present!) and utilizing the standard, less-private interface. Thanks!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shane.harvey Shane Harvey
              Reporter:
              amcgregor Dissatisfied Former User
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: