Merge pull request #4534 from rzimmerdev/main

Adapted input parameters type restriction for json.loads function - fixes #4519
This commit is contained in:
David Lord 2022-04-24 09:58:01 -07:00 committed by GitHub
commit dba2be9311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,9 @@ Version 2.1.2
Unreleased Unreleased
- Fix type annotation for ``json.loads``, it accepts str or bytes.
:issue:`4519`
Version 2.1.1 Version 2.1.1
------------- -------------

View File

@ -153,7 +153,11 @@ def dump(
_json.dump(obj, fp, **kwargs) _json.dump(obj, fp, **kwargs)
def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any: def loads(
s: t.Union[str, bytes],
app: t.Optional["Flask"] = None,
**kwargs: t.Any,
) -> t.Any:
"""Deserialize an object from a string of JSON. """Deserialize an object from a string of JSON.
Takes the same arguments as the built-in :func:`json.loads`, with Takes the same arguments as the built-in :func:`json.loads`, with