diff options
author | Victor Stinner <vstinner@redhat.com> | 2016-06-29 11:13:00 +0200 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2016-07-22 19:16:39 +0200 |
commit | d6e9a0047bad780b53151f572ea257f1cb6ebe41 (patch) | |
tree | c1131db19a1207904817989d4777224bd64da8de /jsonpatch.py | |
parent | c9ac1d9f0a9ab522614c36beb70b74db45492fc1 (diff) | |
download | python-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
Diffstat (limited to 'jsonpatch.py')
-rw-r--r-- | jsonpatch.py | 7 |
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) |