fix annotation for json.loads

This commit is contained in:
Rafael Zimmer 2022-04-12 13:17:24 -03:00 committed by David Lord
parent 69f71b4d94
commit eede1a3685
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 8 additions and 1 deletions

View file

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

View file

@ -153,7 +153,11 @@ def dump(
_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.
Takes the same arguments as the built-in :func:`json.loads`, with