summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2016-06-29 11:13:00 +0200
committerVictor Stinner <vstinner@redhat.com>2016-07-22 19:16:39 +0200
commitd6e9a0047bad780b53151f572ea257f1cb6ebe41 (patch)
treec1131db19a1207904817989d4777224bd64da8de
parentc9ac1d9f0a9ab522614c36beb70b74db45492fc1 (diff)
downloadpython-json-patch-d6e9a0047bad780b53151f572ea257f1cb6ebe41.tar.gz
Use inspect.signature() on Python 3
The inspect.getargspec() function has been deprecated in Python 3: https://docs.python.org/3/library/inspect.html#inspect.getargspec
-rw-r--r--jsonpatch.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index 32508e2..3c83f61 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -105,8 +105,11 @@ def get_loadjson():
function with object_pairs_hook set to multidict for Python versions that
support the parameter. """
- argspec = inspect.getargspec(json.load)
- if 'object_pairs_hook' not in argspec.args:
+ 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)