From d6e9a0047bad780b53151f572ea257f1cb6ebe41 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 29 Jun 2016 11:13:00 +0200 Subject: [PATCH] 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 --- jsonpatch.py | 7 +++++-- 1 file 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)