diff options
author | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 18:49:09 +0100 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2017-11-25 18:49:09 +0100 |
commit | 7b4fb660a5d6ff7d81c35ea1565b751a994aa854 (patch) | |
tree | d9d83775fdbdae9c9e145fecc649d5eb500db2bb /jsonpatch.py | |
parent | 6b777b7c414f69f3b8f3c16ba1c871246b481d4f (diff) | |
parent | b6514dd9551d453f2ee8485283d538e00f5015be (diff) | |
download | python-json-patch-7b4fb660a5d6ff7d81c35ea1565b751a994aa854.tar.gz |
Merge branch 'master' into jsondiff
Diffstat (limited to 'jsonpatch.py')
-rw-r--r-- | jsonpatch.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/jsonpatch.py b/jsonpatch.py index b490108..c4cbb30 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -103,25 +103,9 @@ def multidict(ordered_pairs): ) -def get_loadjson(): - """ adds the object_pairs_hook parameter to json.load when possible - - The "object_pairs_hook" parameter is used to handle duplicate keys when - loading a JSON object. This parameter does not exist in Python 2.6. This - methods returns an unmodified json.load for Python 2.6 and a partial - function with object_pairs_hook set to multidict for Python versions that - support the parameter. """ - - if sys.version_info >= (3, 3): - args = inspect.signature(json.load).parameters - else: - args = inspect.getargspec(json.load).args - if 'object_pairs_hook' not in args: - return json.load - - return functools.partial(json.load, object_pairs_hook=multidict) - -json.load = get_loadjson() +# The "object_pairs_hook" parameter is used to handle duplicate keys when +# loading a JSON object. +json.load = functools.partial(json.load, object_pairs_hook=multidict) def apply_patch(doc, patch, in_place=False): |