From 074f937de30079dfec69733cc5fe4cd459faee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sat, 21 Oct 2017 11:19:35 +0200 Subject: Avoid overriding json.load (fixes #37) --- jsonpatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'jsonpatch.py') diff --git a/jsonpatch.py b/jsonpatch.py index e1a5b2d..41c14a4 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -98,7 +98,7 @@ def multidict(ordered_pairs): # 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) +_jsonloads = functools.partial(json.loads, object_pairs_hook=multidict) def apply_patch(doc, patch, in_place=False): @@ -260,7 +260,7 @@ class JsonPatch(object): :return: :class:`JsonPatch` instance. """ - patch = json.loads(patch_str) + patch = _jsonloads(patch_str) return cls(patch) @classmethod -- cgit v1.2.1