mirror of https://github.com/pallets/flask.git
Merge pull request #4534 from rzimmerdev/main
Adapted input parameters type restriction for json.loads function - fixes #4519
This commit is contained in:
commit
dba2be9311
|
@ -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
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue