From fce021b9700b81c8a9f36e5a983760b42087ef8d1f3200531f11c00bfcd03fcd Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 26 Oct 2022 12:40:27 +0000 Subject: [PATCH] - Add no-inspect-getargspec.patch porting out deprecated (and in 3.11 removed) method inspect.getargspec (gh#pympler/pympler#148). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Pympler?expand=0&rev=13 --- no-inspect-getargspec.patch | 33 +++++++++++++++++++++++++++++++++ pympler-flaky-tests.patch | 12 +++++++----- python-Pympler.changes | 7 +++++++ python-Pympler.spec | 8 ++++++-- 4 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 no-inspect-getargspec.patch diff --git a/no-inspect-getargspec.patch b/no-inspect-getargspec.patch new file mode 100644 index 0000000..d65043e --- /dev/null +++ b/no-inspect-getargspec.patch @@ -0,0 +1,33 @@ +--- + pympler/util/bottle.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/pympler/util/bottle.py ++++ b/pympler/util/bottle.py +@@ -41,7 +41,7 @@ import base64, cgi, email.utils, functoo + from datetime import date as datedate, datetime, timedelta + from tempfile import TemporaryFile + from traceback import format_exc, print_exc +-from inspect import getargspec ++from inspect import getfullargspec + from unicodedata import normalize + + +@@ -554,7 +554,7 @@ class Route(object): + ''' Return a list of argument names the callback (most likely) accepts + as keyword arguments. If the callback is a decorated function, try + to recover the original function before inspection. ''' +- return getargspec(self.get_undecorated_callback())[0] ++ return getfullargspec(self.get_undecorated_callback())[0] + + def get_config(self, key, default=None): + ''' Lookup a config field and return its value, first checking the +@@ -2645,7 +2645,7 @@ def yieldroutes(func): + d(x=5, y=6) -> '/d' and '/d/' and '/d//' + """ + path = '/' + func.__name__.replace('__','/').lstrip('/') +- spec = getargspec(func) ++ spec = getfullargspec(func) + argc = len(spec[0]) - len(spec[3] or []) + path += ('/<%s>' * argc) % tuple(spec[0][:argc]) + yield path diff --git a/pympler-flaky-tests.patch b/pympler-flaky-tests.patch index 7976089..68693b9 100644 --- a/pympler-flaky-tests.patch +++ b/pympler-flaky-tests.patch @@ -1,8 +1,10 @@ -Index: Pympler-0.7/test/asizeof/test_asizeof.py -=================================================================== ---- Pympler-0.7.orig/test/asizeof/test_asizeof.py -+++ Pympler-0.7/test/asizeof/test_asizeof.py -@@ -197,8 +197,8 @@ class TypesTest(unittest.TestCase): +--- + test/asizeof/test_asizeof.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/test/asizeof/test_asizeof.py ++++ b/test/asizeof/test_asizeof.py +@@ -193,8 +193,8 @@ class TypesTest(unittest.TestCase): s = asizeof.asizeof(all=True, code=True) c = gc.collect() # NumPy (and/or other, recent) modules causes some diff --git a/python-Pympler.changes b/python-Pympler.changes index 0aa77cd..d2ecff2 100644 --- a/python-Pympler.changes +++ b/python-Pympler.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Oct 26 12:37:21 UTC 2022 - Matej Cepl + +- Add no-inspect-getargspec.patch porting out deprecated + (and in 3.11 removed) method inspect.getargspec + (gh#pympler/pympler#148). + ------------------------------------------------------------------- Wed Jun 8 08:24:18 UTC 2022 - Matej Cepl diff --git a/python-Pympler.spec b/python-Pympler.spec index 2048059..b37a972 100644 --- a/python-Pympler.spec +++ b/python-Pympler.spec @@ -25,7 +25,12 @@ Summary: A tool to analyze the memory behavior of Python objects License: Apache-2.0 URL: https://github.com/pympler/pympler Source: https://files.pythonhosted.org/packages/source/P/Pympler/Pympler-%{version}.tar.gz +# PATCH-FIX-UPSTREAM pympler-flaky-tests.patch gh#pympler/pympler#90 mcepl@suse.com +# More cycles needed with more recent versions of Python Patch0: pympler-flaky-tests.patch +# PATCH-{FIX|FEATURE}-{OPENSUSE|SLE|UPSTREAM} name-of-file.patch bsc#[0-9]+ mcepl@suse.com +# this patch makes things totally awesome +Patch1: no-inspect-getargspec.patch BuildRequires: %{python_module dbm} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} @@ -44,8 +49,7 @@ unexpected runtime behavior like memory bloat and other "pymples" can easily be identified. %prep -%setup -q -n Pympler-%{version} -%patch0 -p1 +%autosetup -p1 -n Pympler-%{version} %build %python_build