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

Fix inconsistent handling of bson.code.Code with explicit empty scope

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change

      Description

      Two problems...

      1. There is no way to encode Code with explicit empty scope to BSON type 0x0F. Code with explicit empty scope (Code("", {})) is always stored as BSON type 0x0D.
      2. json_util always exports Code with $scope.

      The solution is probably to set bson.code.Code.__scope to None when Code was created without an explicit scope, then have the bson encoder and json_util treat None and {} separately. Also add a warning in the changelog, since bson.code.Code.scope currently always returns a dict.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              luke.lovett Luke Lovett
              Reporter:
              behackett Bernie Hackett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: