Type annotation of `bson.json_utils.loads` is incorrect (only accepts `str`)

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 4.4
    • Affects Version/s: None
    • Component/s: Typing
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The type annotations in the definition of the `bson.json_util.loads` function is incorrect. It says the function only accepts `str`. But, since it delegate it's implementation to the Python standard library `json` module, it in facts allows decoding `str`, `bytes` and `bytearray` (cf. documentation).

      Note that forcing user to pass a str could have a negative impact on performances. I didn't do any benchmarks yet.

              Assignee:
              Julius Park (Inactive)
              Reporter:
              Nicolas Caniart
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: