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

BSON C module directly accesses private attributes.

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

      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!

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            alice@gothcandy.com Dissatisfied Former User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: