summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-21 21:03:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-21 21:03:20 (GMT)
commitaacd53f6cb96fe8c4fe9ce894f22e25f356a97c3 (patch)
tree4ba936a620bf3170ae9c7f74c35bf52142e40288 /Lib/json
parent43354375063662deda272b9a2d64cf53d6b748f3 (diff)
downloadcpython-aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3.zip
cpython-aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3.tar.gz
cpython-aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3.tar.bz2
Issue #18726: All optional parameters of the dump(), dumps(),
load() and loads() functions and JSONEncoder and JSONDecoder class constructors in the json module are now keyword-only.
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/__init__.py8
-rw-r--r--Lib/json/decoder.py2
-rw-r--r--Lib/json/encoder.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py
index 2612657..28057dd 100644
--- a/Lib/json/__init__.py
+++ b/Lib/json/__init__.py
@@ -116,7 +116,7 @@ _default_encoder = JSONEncoder(
default=None,
)
-def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
+def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
default=None, sort_keys=False, **kw):
"""Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
@@ -179,7 +179,7 @@ def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
fp.write(chunk)
-def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
+def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
default=None, sort_keys=False, **kw):
"""Serialize ``obj`` to a JSON formatted ``str``.
@@ -240,7 +240,7 @@ def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
_default_decoder = JSONDecoder(object_hook=None, object_pairs_hook=None)
-def load(fp, cls=None, object_hook=None, parse_float=None,
+def load(fp, *, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
"""Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
a JSON document) to a Python object.
@@ -268,7 +268,7 @@ def load(fp, cls=None, object_hook=None, parse_float=None,
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
-def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
+def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
"""Deserialize ``s`` (a ``str`` instance containing a JSON
document) to a Python object.
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 0f03f20..2422c6a 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -280,7 +280,7 @@ class JSONDecoder(object):
"""
- def __init__(self, object_hook=None, parse_float=None,
+ def __init__(self, *, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, strict=True,
object_pairs_hook=None):
"""``object_hook``, if specified, will be called with the result
diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py
index 0772bbc..41a497c 100644
--- a/Lib/json/encoder.py
+++ b/Lib/json/encoder.py
@@ -101,7 +101,7 @@ class JSONEncoder(object):
"""
item_separator = ', '
key_separator = ': '
- def __init__(self, skipkeys=False, ensure_ascii=True,
+ def __init__(self, *, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, default=None):
"""Constructor for JSONEncoder, with sensible defaults.