diff --git a/python-jsonpatch.spec b/python-jsonpatch.spec index a376794..3cda7c6 100644 --- a/python-jsonpatch.spec +++ b/python-jsonpatch.spec @@ -13,6 +13,9 @@ URL: https://github.com/stefankoegl/%{github_name} #Source0: https://pypi.python.org/packages/source/j/%{pypi_name}/%{pypi_name}-%{version}.tar.gz # pypi tarball does not contain README.md and tests.py Source0: https://pypi.io/packages/source/j/jsonpatch/%{pypi_name}-%{version}.tar.gz +# Fix python 3 tests +# From upstream commit: https://github.com/stefankoegl/python-json-patch/commit/d6e9a0047bad780b53151f572ea257f1cb6ebe41 +Patch0: use-inspect.signature-on-Python-3.patch BuildArch: noarch @@ -50,6 +53,7 @@ Library to apply JSON Patches according to RFC 6902 - Python 3 build. %prep %setup -qn %{pypi_name}-%{version} +%patch0 -p1 %build %py2_build @@ -112,6 +116,7 @@ done; %changelog * Fri Dec 09 2016 Charalampos Stratakis - 1.14-2 - Rebuild for Python 3.6 +- Added upstream patch for fixing python3 tests failures * Mon Sep 5 2016 Haïkel Guémar - 1.14-1 - Upstream 1.14 diff --git a/use-inspect.signature-on-Python-3.patch b/use-inspect.signature-on-Python-3.patch new file mode 100644 index 0000000..48df694 --- /dev/null +++ b/use-inspect.signature-on-Python-3.patch @@ -0,0 +1,29 @@ +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)