Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-wrapt for openSUSE:Factory checked in at 2022-10-03 13:44:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-wrapt (Old) and /work/SRC/openSUSE:Factory/.python-wrapt.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-wrapt" Mon Oct 3 13:44:34 2022 rev:15 rq:1007459 version:1.14.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-wrapt/python-wrapt.changes 2021-11-09 23:54:21.607944969 +0100 +++ /work/SRC/openSUSE:Factory/.python-wrapt.new.2275/python-wrapt.changes 2022-10-03 13:44:50.809360624 +0200 @@ -1,0 +2,25 @@ +Sat Oct 1 14:04:50 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 1.14.1: + * When the post import hooks mechanism was being used, and a Python package with + its own custom module importer was used, importing modules could fail if the + custom module importer didn't use the latest Python import hook finder/loader + APIs and instead used the deprecated API. This was actually occurring with the + `zipimporter` in Python itself, which was not updated to use the newer Python + APIs until Python 3.10. + **Bugs Fixed** + * Python 3.11 dropped ``inspect.formatargspec()`` which was used in creating + signature changing decorators. Now bundling a version of this function + which uses ``Parameter`` and ``Signature`` from ``inspect`` module when + available. The replacement function is exposed as ``wrapt.formatargspec()`` + if need it for your own code. + * When using a decorator on a class, ``isinstance()`` checks wouldn't previously + work as expected and you had to manually use ``Type.__wrapped__`` to access + the real type when doing instance checks. The ``__instancecheck__`` hook is + now implemented such that you don't have to use ``Type.__wrapped__`` instead + of ``Type`` as last argument to ``isinstance()``. + * Eliminated deprecation warnings related to Python module import system, which + would have turned into broken code in Python 3.12. This was used by the post + import hook mechanism. + +------------------------------------------------------------------- Old: ---- 1.13.3.tar.gz New: ---- 1.14.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-wrapt.spec ++++++ --- /var/tmp/diff_new_pack.Iq4Cf7/_old 2022-10-03 13:44:51.297361697 +0200 +++ /var/tmp/diff_new_pack.Iq4Cf7/_new 2022-10-03 13:44:51.305361715 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-wrapt # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2015 LISA GmbH, Bingen, Germany. # # All modifications and additions to the file contributed by third parties @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-wrapt -Version: 1.13.3 +Version: 1.14.1 Release: 0 Summary: A Python module for decorators, wrappers and monkey patching License: BSD-2-Clause ++++++ 1.13.3.tar.gz -> 1.14.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/.github/workflows/main.yml new/wrapt-1.14.1/.github/workflows/main.yml --- old/wrapt-1.13.3/.github/workflows/main.yml 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/.github/workflows/main.yml 2022-05-02 06:27:44.000000000 +0200 @@ -19,7 +19,7 @@ - 3.8 - 3.9 - "3.10" - #- 3.11-dev + - 3.11-dev - pypy-2.7 - pypy-3.6 - pypy-3.7 @@ -42,6 +42,40 @@ name: coverage path: .coverage.* + test_aarch64_linux: + name: Test (${{ matrix.python.os }}, ${{ matrix.python.python-version }}, aarch64) + runs-on: ${{ matrix.python.os }} + strategy: + matrix: + python: + #- {os: ubuntu-latest, python-version: 3.7, pyver: py37} + #- {os: ubuntu-latest, python-version: 3.8, pyver: py38} + #- {os: ubuntu-latest, python-version: 3.9, pyver: py39} + - {os: ubuntu-latest, python-version: "3.10", pyver: py310} + env: + py: python${{ matrix.python.python-version }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + - name: Test with tox + run: | + docker run --rm -v ${{ github.workspace }}:/io:rw --workdir=/io \ + arm64v8/ubuntu \ + bash -exc 'apt-get update && \ + apt install software-properties-common -y && \ + add-apt-repository ppa:deadsnakes/ppa -y && \ + apt install -y ${{ env.py }} && \ + apt install -y ${{ env.py }}-venv && \ + ${{ env.py }} -m venv .env && \ + source .env/bin/activate && \ + pip install -U pip wheel setuptools && \ + pip install tox tox-gh-actions && \ + tox -e ${{ matrix.python.pyver }} && \ + deactivate' + test_macos: name: Test (${{ matrix.os }}, ${{ matrix.python-version }}) runs-on: ${{ matrix.os }} @@ -57,7 +91,7 @@ - 3.8 - 3.9 - "3.10" - #- 3.11-dev + - 3.11-dev - pypy-2.7 #- pypy-3.6 - pypy-3.7 @@ -117,7 +151,7 @@ - 3.8 - 3.9 - "3.10" - #- 3.11-dev + - 3.11-dev - pypy-2.7 - pypy-3.6 - pypy-3.7 @@ -187,9 +221,10 @@ path: dist/*.whl bdist_wheel: - name: Build wheels (3.6+) on ${{ matrix.os }} + name: Build wheels (3.6+) on ${{ matrix.os }} for ${{ matrix.arch }} needs: - test_linux + - test_aarch64_linux - test_macos - test_windows_py27 - test_windows @@ -197,16 +232,26 @@ strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] + arch: [auto] + include: + - os: ubuntu-latest + arch: aarch64 + - os: macos-latest + arch: arm64 steps: - uses: actions/checkout@v2 + - name: Set up QEMU + if: ${{ matrix.arch == 'aarch64' }} + uses: docker/setup-qemu-action@v1 - name: Build wheels - uses: pypa/cibuildwheel@v2.2.0 + uses: pypa/cibuildwheel@v2.4.0 with: output-dir: dist env: WRAPT_INSTALL_EXTENSIONS: true CIBW_SKIP: pp* CIBW_BUILD_VERBOSITY: 1 + CIBW_ARCHS: ${{ matrix.arch }} - uses: actions/upload-artifact@v2 with: name: dist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/.readthedocs.yaml new/wrapt-1.14.1/.readthedocs.yaml --- old/wrapt-1.13.3/.readthedocs.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/wrapt-1.14.1/.readthedocs.yaml 2022-05-02 06:27:44.000000000 +0200 @@ -0,0 +1,23 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF +#formats: +# - pdf + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.8 +# install: +# - requirements: docs/requirements.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/LICENSE new/wrapt-1.14.1/LICENSE --- old/wrapt-1.13.3/LICENSE 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/LICENSE 2022-05-02 06:27:44.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2013-2019, Graham Dumpleton +Copyright (c) 2013-2022, Graham Dumpleton All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/docs/changes.rst new/wrapt-1.14.1/docs/changes.rst --- old/wrapt-1.13.3/docs/changes.rst 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/docs/changes.rst 2022-05-02 06:27:44.000000000 +0200 @@ -1,6 +1,44 @@ Release Notes ============= +Version 1.14.1 +-------------- + +**Bugs Fixed** + +* When the post import hooks mechanism was being used, and a Python package with + its own custom module importer was used, importing modules could fail if the + custom module importer didn't use the latest Python import hook finder/loader + APIs and instead used the deprecated API. This was actually occurring with the + `zipimporter` in Python itself, which was not updated to use the newer Python + APIs until Python 3.10. + +Version 1.14.0 +-------------- + +**Bugs Fixed** + +* Python 3.11 dropped ``inspect.formatargspec()`` which was used in creating + signature changing decorators. Now bundling a version of this function + which uses ``Parameter`` and ``Signature`` from ``inspect`` module when + available. The replacement function is exposed as ``wrapt.formatargspec()`` + if need it for your own code. + +* When using a decorator on a class, ``isinstance()`` checks wouldn't previously + work as expected and you had to manually use ``Type.__wrapped__`` to access + the real type when doing instance checks. The ``__instancecheck__`` hook is + now implemented such that you don't have to use ``Type.__wrapped__`` instead + of ``Type`` as last argument to ``isinstance()``. + +* Eliminated deprecation warnings related to Python module import system, which + would have turned into broken code in Python 3.12. This was used by the post + import hook mechanism. + +**New Features** + +* Binary wheels provided on PyPi for ``aarch64`` Linux systems and macOS + native silicon where supported by Python when using ``pypa/cibuildwheel``. + Version 1.13.3 -------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/setup.cfg new/wrapt-1.14.1/setup.cfg --- old/wrapt-1.13.3/setup.cfg 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/setup.cfg 2022-05-02 06:27:44.000000000 +0200 @@ -25,6 +25,7 @@ Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy project_urls = @@ -93,6 +94,8 @@ deps = coverage pytest +install_command = + py311,py311-{without,install,disable}-extensions: python -m pip install --no-binary coverage {opts} {packages} commands = python -m coverage run --rcfile {toxinidir}/setup.cfg -m pytest -v {posargs} {toxinidir}/tests setenv = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/__init__.py new/wrapt-1.14.1/src/wrapt/__init__.py --- old/wrapt-1.13.3/src/wrapt/__init__.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/src/wrapt/__init__.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,4 +1,4 @@ -__version_info__ = ('1', '13', '3') +__version_info__ = ('1', '14', '1') __version__ = '.'.join(__version_info__) from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper, @@ -13,4 +13,15 @@ from .importer import (register_post_import_hook, when_imported, notify_module_loaded, discover_post_import_hooks) +# Import of inspect.getcallargs() included for backward compatibility. An +# implementation of this was previously bundled and made available here for +# Python <2.7. Avoid using this in future. + from inspect import getcallargs + +# Variant of inspect.formatargspec() included here for forward compatibility. +# This is being done because Python 3.11 dropped inspect.formatargspec() but +# code for handling signature changing decorators relied on it. Exposing the +# bundled implementation here in case any user of wrapt was also needing it. + +from .arguments import formatargspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/_wrappers.c new/wrapt-1.14.1/src/wrapt/_wrappers.c --- old/wrapt-1.13.3/src/wrapt/_wrappers.c 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/src/wrapt/_wrappers.c 2022-05-02 06:27:44.000000000 +0200 @@ -2544,6 +2544,33 @@ /* ------------------------------------------------------------------------- */ +static PyObject *WraptFunctionWrapperBase_instancecheck( + WraptFunctionWrapperObject *self, PyObject *instance) +{ + PyObject *object = NULL; + PyObject *result = NULL; + + int check = 0; + + if (!self->object_proxy.wrapped) { + PyErr_SetString(PyExc_ValueError, "wrapper has not been initialized"); + return NULL; + } + + check = PyObject_IsInstance(instance, self->object_proxy.wrapped); + + if (check < 0) { + return NULL; + } + + result = check ? Py_True : Py_False; + + Py_INCREF(result); + return result; +} + +/* ------------------------------------------------------------------------- */ + static PyObject *WraptFunctionWrapperBase_subclasscheck( WraptFunctionWrapperObject *self, PyObject *args) { @@ -2656,6 +2683,8 @@ static PyMethodDef WraptFunctionWrapperBase_methods[] = { { "__set_name__", (PyCFunction)WraptFunctionWrapperBase_set_name, METH_VARARGS | METH_KEYWORDS, 0 }, + { "__instancecheck__", (PyCFunction)WraptFunctionWrapperBase_instancecheck, + METH_O, 0}, { "__subclasscheck__", (PyCFunction)WraptFunctionWrapperBase_subclasscheck, METH_VARARGS, 0 }, { NULL, NULL }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/arguments.py new/wrapt-1.14.1/src/wrapt/arguments.py --- old/wrapt-1.13.3/src/wrapt/arguments.py 1970-01-01 01:00:00.000000000 +0100 +++ new/wrapt-1.14.1/src/wrapt/arguments.py 2022-05-02 06:27:44.000000000 +0200 @@ -0,0 +1,38 @@ +# The inspect.formatargspec() function was dropped in Python 3.11 but we need +# need it for when constructing signature changing decorators based on result of +# inspect.getargspec() or inspect.getfullargspec(). The code here implements +# inspect.formatargspec() base on Parameter and Signature from inspect module, +# which were added in Python 3.6. Thanks to Cyril Jouve for the implementation. + +try: + from inspect import Parameter, Signature +except ImportError: + from inspect import formatargspec +else: + def formatargspec(args, varargs=None, varkw=None, defaults=None, + kwonlyargs=(), kwonlydefaults={}, annotations={}): + if kwonlydefaults is None: + kwonlydefaults = {} + ndefaults = len(defaults) if defaults else 0 + parameters = [ + Parameter( + arg, + Parameter.POSITIONAL_OR_KEYWORD, + default=defaults[i] if i >= 0 else Parameter.empty, + annotation=annotations.get(arg, Parameter.empty), + ) for i, arg in enumerate(args, ndefaults - len(args)) + ] + if varargs: + parameters.append(Parameter(varargs, Parameter.VAR_POSITIONAL)) + parameters.extend( + Parameter( + kwonlyarg, + Parameter.KEYWORD_ONLY, + default=kwonlydefaults.get(kwonlyarg, Parameter.empty), + annotation=annotations.get(kwonlyarg, Parameter.empty), + ) for kwonlyarg in kwonlyargs + ) + if varkw: + parameters.append(Parameter(varkw, Parameter.VAR_KEYWORD)) + return_annotation = annotations.get('return', Signature.empty) + return str(Signature(parameters, return_annotation=return_annotation)) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/decorators.py new/wrapt-1.14.1/src/wrapt/decorators.py --- old/wrapt-1.13.3/src/wrapt/decorators.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/src/wrapt/decorators.py 2022-05-02 06:27:44.000000000 +0200 @@ -31,10 +31,11 @@ del builtins from functools import partial -from inspect import ismethod, isclass, formatargspec -from collections import namedtuple +from inspect import isclass from threading import Lock, RLock +from .arguments import formatargspec + try: from inspect import signature except ImportError: @@ -383,7 +384,7 @@ # This one is a bit strange because binding was actually # performed on the wrapper created by our decorator # factory. We need to apply that binding to the decorator - # wrapper function which which the decorator factory + # wrapper function that the decorator factory # was applied to. target_wrapper = wrapper.__get__(None, instance) @@ -407,7 +408,7 @@ # This one is a bit strange because binding was actually # performed on the wrapper created by our decorator # factory. We need to apply that binding to the decorator - # wrapper function which which the decorator factory + # wrapper function that the decorator factory # was applied to. target_wrapper = wrapper.__get__(instance, type(instance)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/importer.py new/wrapt-1.14.1/src/wrapt/importer.py --- old/wrapt-1.13.3/src/wrapt/importer.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/src/wrapt/importer.py 2022-05-02 06:27:44.000000000 +0200 @@ -10,9 +10,10 @@ if PY2: string_types = basestring, + find_spec = None else: - import importlib string_types = str, + from importlib.util import find_spec from .decorators import synchronized @@ -152,12 +153,29 @@ def __init__(self, loader): self.loader = loader - def load_module(self, fullname): + if hasattr(loader, "load_module"): + self.load_module = self._load_module + if hasattr(loader, "create_module"): + self.create_module = self._create_module + if hasattr(loader, "exec_module"): + self.exec_module = self._exec_module + + def _load_module(self, fullname): module = self.loader.load_module(fullname) notify_module_loaded(module) return module + # Python 3.4 introduced create_module() and exec_module() instead of + # load_module() alone. Splitting the two steps. + + def _create_module(self, spec): + return self.loader.create_module(spec) + + def _exec_module(self, module): + self.loader.exec_module(module) + notify_module_loaded(module) + class ImportHookFinder: def __init__(self): @@ -187,7 +205,7 @@ # Now call back into the import system again. try: - if PY2: + if not find_spec: # For Python 2 we don't have much choice but to # call back in to __import__(). This will # actually cause the module to be imported. If no @@ -208,14 +226,52 @@ # our own loader which will then in turn call the # real loader to import the module and invoke the # post import hooks. - try: - import importlib.util - loader = importlib.util.find_spec(fullname).loader - except (ImportError, AttributeError): - loader = importlib.find_loader(fullname, path) - if loader: + + loader = getattr(find_spec(fullname), "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): return _ImportHookChainedLoader(loader) + finally: + del self.in_progress[fullname] + + def find_spec(self, fullname, path=None, target=None): + # Since Python 3.4, you are meant to implement find_spec() method + # instead of find_module() and since Python 3.10 you get deprecation + # warnings if you don't define find_spec(). + + # If the module being imported is not one we have registered + # post import hooks for, we can return immediately. We will + # take no further part in the importing of this module. + + if not fullname in _post_import_hooks: + return None + + # When we are interested in a specific module, we will call back + # into the import system a second time to defer to the import + # finder that is supposed to handle the importing of the module. + # We set an in progress flag for the target module so that on + # the second time through we don't trigger another call back + # into the import system and cause a infinite loop. + + if fullname in self.in_progress: + return None + + self.in_progress[fullname] = True + + # Now call back into the import system again. + + try: + # This should only be Python 3 so find_spec() should always + # exist so don't need to check. + + spec = find_spec(fullname) + loader = getattr(spec, "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): + spec.loader = _ImportHookChainedLoader(loader) + + return spec finally: del self.in_progress[fullname] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/src/wrapt/wrappers.py new/wrapt-1.14.1/src/wrapt/wrappers.py --- old/wrapt-1.13.3/src/wrapt/wrappers.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/src/wrapt/wrappers.py 2022-05-02 06:27:44.000000000 +0200 @@ -87,7 +87,7 @@ pass # Python 3.10 onwards also does not allow itself to be overridden - # using a properly and it must instead be set explicitly. + # using a property and it must instead be set explicitly. try: object.__setattr__(self, '__annotations__', wrapped.__annotations__) @@ -588,6 +588,11 @@ if hasattr(self.__wrapped__, "__set_name__"): self.__wrapped__.__set_name__(owner, name) + def __instancecheck__(self, instance): + # This is a special method used by isinstance() to make checks + # instance of the `__wrapped__`. + return isinstance(instance, self.__wrapped__) + def __subclasscheck__(self, subclass): # This is a special method used by issubclass() to make checks # about inheritance of classes. We need to upwrap any object diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/compat.py new/wrapt-1.14.1/tests/compat.py --- old/wrapt-1.13.3/tests/compat.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/compat.py 2022-05-02 06:27:44.000000000 +0200 @@ -26,3 +26,8 @@ exec_("""def reraise(tp, value, tb=None): raise tp, value, tb """) + +try: + from inspect import getfullargspec +except ImportError: + from inspect import getargspec as getfullargspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/conftest.py new/wrapt-1.14.1/tests/conftest.py --- old/wrapt-1.13.3/tests/conftest.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/conftest.py 2022-05-02 06:27:44.000000000 +0200 @@ -35,6 +35,8 @@ return construct_dummy(path, parent) if '_py310' in path.basename and version < (3, 10): return construct_dummy(path, parent) + if '_py311' in path.basename and version < (3, 11): + return construct_dummy(path, parent) if '_py3' in path.basename and version < (3, 0): return construct_dummy(path, parent) if '_py2' in path.basename and version >= (3, 0): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_adapter.py new/wrapt-1.14.1/tests/test_adapter.py --- old/wrapt-1.13.3/tests/test_adapter.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_adapter.py 2022-05-02 06:27:44.000000000 +0200 @@ -6,7 +6,7 @@ import wrapt -from compat import PY2, PY3, exec_ +from compat import PY2, exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -72,15 +72,15 @@ def _adapter(arg1, arg2, arg3=None, *args, **kwargs): pass - function1a_argspec = inspect.getargspec(_adapter) - function1d_argspec = inspect.getargspec(function1d) + function1a_argspec = getfullargspec(_adapter) + function1d_argspec = getfullargspec(function1d) self.assertEqual(function1a_argspec, function1d_argspec) # Now bind the function to an instance. The argspec should # still match. bound_function1d = function1d.__get__(object(), object) - bound_function1d_argspec = inspect.getargspec(bound_function1d) + bound_function1d_argspec = getfullargspec(bound_function1d) self.assertEqual(function1a_argspec, bound_function1d_argspec) def test_signature(self): @@ -107,7 +107,7 @@ def test_dynamic_adapter_function(self): def _adapter(arg1, arg2, arg3=None, *args, **kwargs): pass - argspec = inspect.getargspec(_adapter) + argspec = getfullargspec(_adapter) @wrapt.decorator(adapter=argspec) def _wrapper_1(wrapped, instance, args, kwargs): @@ -117,9 +117,9 @@ def _function_1(): pass - self.assertEqual(inspect.getargspec(_function_1), argspec) + self.assertEqual(getfullargspec(_function_1), argspec) - args = inspect.formatargspec(*argspec) + args = '(arg1, arg2, arg3=None, *args, **kwargs)' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): @@ -129,12 +129,12 @@ def _function_2(): pass - self.assertEqual(inspect.getargspec(_function_2), argspec) + self.assertEqual(getfullargspec(_function_2), argspec) def test_dynamic_adapter_instancemethod(self): def _adapter(self, arg1, arg2, arg3=None, *args, **kwargs): pass - argspec = inspect.getargspec(_adapter) + argspec = getfullargspec(_adapter) @wrapt.decorator(adapter=argspec) def _wrapper_1(wrapped, instance, args, kwargs): @@ -147,10 +147,10 @@ instance1 = Class1() - self.assertEqual(inspect.getargspec(Class1.function), argspec) - self.assertEqual(inspect.getargspec(instance1.function), argspec) + self.assertEqual(getfullargspec(Class1.function), argspec) + self.assertEqual(getfullargspec(instance1.function), argspec) - args = inspect.formatargspec(*argspec) + args = '(self, arg1, arg2, arg3=None, *args, **kwargs)' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): @@ -163,13 +163,13 @@ instance2 = Class2() - self.assertEqual(inspect.getargspec(Class2.function), argspec) - self.assertEqual(inspect.getargspec(instance2.function), argspec) + self.assertEqual(getfullargspec(Class2.function), argspec) + self.assertEqual(getfullargspec(instance2.function), argspec) def test_dynamic_adapter_classmethod(self): def _adapter(cls, arg1, arg2, arg3=None, *args, **kwargs): pass - argspec = inspect.getargspec(_adapter) + argspec = getfullargspec(_adapter) @wrapt.decorator(adapter=argspec) def _wrapper_1(wrapped, instance, args, kwargs): @@ -183,10 +183,10 @@ instance1 = Class1() - self.assertEqual(inspect.getargspec(Class1.function), argspec) - self.assertEqual(inspect.getargspec(instance1.function), argspec) + self.assertEqual(getfullargspec(Class1.function), argspec) + self.assertEqual(getfullargspec(instance1.function), argspec) - args = inspect.formatargspec(*argspec) + args = '(cls, arg1, arg2, arg3=None, *args, **kwargs)' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): @@ -200,12 +200,12 @@ instance2 = Class2() - self.assertEqual(inspect.getargspec(Class2.function), argspec) - self.assertEqual(inspect.getargspec(instance2.function), argspec) + self.assertEqual(getfullargspec(Class2.function), argspec) + self.assertEqual(getfullargspec(instance2.function), argspec) def test_adapter_factory(self): def factory(wrapped): - argspec = inspect.getargspec(wrapped) + argspec = getfullargspec(wrapped) argspec.args.insert(0, 'arg0') return argspec @@ -217,7 +217,7 @@ def _function_1(arg1, arg2): pass - argspec = inspect.getargspec(_function_1) + argspec = getfullargspec(_function_1) self.assertEqual(argspec.args, ['arg0', 'arg1', 'arg2']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_adapter_py3.py new/wrapt-1.14.1/tests/test_adapter_py3.py --- old/wrapt-1.13.3/tests/test_adapter_py3.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_adapter_py3.py 2022-05-02 06:27:44.000000000 +0200 @@ -3,13 +3,12 @@ import inspect import unittest import imp -import collections from typing import Iterable import wrapt -from compat import PY2, PY3, exec_ +from compat import PY2, exec_ DECORATORS_CODE = """ import wrapt @@ -128,7 +127,7 @@ argspec2 = inspect.getfullargspec(_adapter2) - args = inspect.formatargspec(*argspec2) + args = '(arg1, arg2, arg3=None, *args, **kwargs) -> int' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): @@ -166,7 +165,7 @@ argspec2 = inspect.getfullargspec(_adapter2) - args = inspect.formatargspec(*argspec2) + args = '(self, arg1, arg2, arg3=None, *args, **kwargs) -> int' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): @@ -209,7 +208,7 @@ argspec2 = inspect.getfullargspec(_adapter2) - args = inspect.formatargspec(*argspec2) + args = '(cls, arg1, arg2, arg3=None, *args, **kwargs) -> int' @wrapt.decorator(adapter=args) def _wrapper_2(wrapped, instance, args, kwargs): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_formatargspec_py35.py new/wrapt-1.14.1/tests/test_formatargspec_py35.py --- old/wrapt-1.13.3/tests/test_formatargspec_py35.py 1970-01-01 01:00:00.000000000 +0100 +++ new/wrapt-1.14.1/tests/test_formatargspec_py35.py 2022-05-02 06:27:44.000000000 +0200 @@ -0,0 +1,35 @@ +import unittest +import sys +from inspect import getfullargspec + +from wrapt import formatargspec + +class TestFormatargspec35(unittest.TestCase): + + def assertFormatEqual(self, func, ref): + formatted = formatargspec(*getfullargspec(func)) + self.assertEqual(formatted, ref) + + def test_formatargspec(self): + def foo1(): pass + self.assertFormatEqual(foo1, '()') + + def foo2(a, b='c'): pass + self.assertFormatEqual(foo2, ("(a, b='c')")) + + def foo3(a, b, *args, **kwargs): pass + self.assertFormatEqual(foo3, '(a, b, *args, **kwargs)') + + def foo4(a: int, b) -> list: pass + if sys.version_info[:2] < (3, 7): + formatted4 = '(a:int, b) -> list' + else: + formatted4 = '(a: int, b) -> list' + self.assertFormatEqual(foo4, formatted4) + + # examples from https://www.python.org/dev/peps/pep-3102/ + def sortwords(*wordlist, case_sensitive=False): pass + self.assertFormatEqual(sortwords, '(*wordlist, case_sensitive=False)') + + def compare(a, b, *, key=None): pass + self.assertFormatEqual(compare, '(a, b, *, key=None)') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_formatargspec_py38.py new/wrapt-1.14.1/tests/test_formatargspec_py38.py --- old/wrapt-1.13.3/tests/test_formatargspec_py38.py 1970-01-01 01:00:00.000000000 +0100 +++ new/wrapt-1.14.1/tests/test_formatargspec_py38.py 2022-05-02 06:27:44.000000000 +0200 @@ -0,0 +1,37 @@ +import unittest +import sys +from inspect import getfullargspec + +from wrapt import formatargspec + +class TestFormatargspec38(unittest.TestCase): + + def assertFormatEqual(self, func, ref): + formatted = formatargspec(*getfullargspec(func)) + self.assertEqual(formatted, ref) + + def test_formatargspec(self): + # exemples from https://www.python.org/dev/peps/pep-0570/ + def name1(p1, p2, /, p_or_kw, *, kw): pass + self.assertFormatEqual(name1, '(p1, p2, p_or_kw, *, kw)') + + def name2(p1, p2=None, /, p_or_kw=None, *, kw): pass + self.assertFormatEqual(name2, '(p1, p2=None, p_or_kw=None, *, kw)') + + def name3(p1, p2=None, /, *, kw): pass + self.assertFormatEqual(name3, '(p1, p2=None, *, kw)') + + def name4(p1, p2=None, /): pass + self.assertFormatEqual(name4, '(p1, p2=None)') + + def name5(p1, p2, /, p_or_kw): pass + self.assertFormatEqual(name5, '(p1, p2, p_or_kw)') + + def name6(p1, p2, /): pass + self.assertFormatEqual(name6, '(p1, p2)') + + def name7(p_or_kw, *, kw): pass + self.assertFormatEqual(name7, '(p_or_kw, *, kw)') + + def name8(*, kw): pass + self.assertFormatEqual(name8, '(*, kw)') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_function.py new/wrapt-1.14.1/tests/test_function.py --- old/wrapt-1.13.3/tests/test_function.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_function.py 2022-05-02 06:27:44.000000000 +0200 @@ -6,7 +6,7 @@ import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -57,8 +57,8 @@ def test_argspec(self): # Test preservation of function argument specification. - function1o_argspec = inspect.getargspec(function1o) - function1d_argspec = inspect.getargspec(function1d) + function1o_argspec = getfullargspec(function1o) + function1d_argspec = getfullargspec(function1d) self.assertEqual(function1o_argspec, function1d_argspec) def test_getmembers(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_inheritance_py37.py new/wrapt-1.14.1/tests/test_inheritance_py37.py --- old/wrapt-1.13.3/tests/test_inheritance_py37.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_inheritance_py37.py 2022-05-02 06:27:44.000000000 +0200 @@ -12,7 +12,7 @@ def test_basic_inheritance(self): @wrapt.decorator def wrapper(wrapped, instance, args, kwargs): - return wrapped(args, kwargs) + return wrapped(*args, **kwargs) class B1: def method(self): @@ -43,6 +43,18 @@ self.assertTrue(issubclass(C1, (B1, C1, D1))) self.assertTrue(issubclass(D1, (B1, C1, D1))) + self.assertTrue(isinstance(C1(), B1)) + self.assertTrue(isinstance(C1(), C1)) + self.assertTrue(isinstance(D1(), B1)) + self.assertTrue(isinstance(D1(), C1)) + + def function(): + pass + class F(wrapt.FunctionWrapper): + pass + instance = F(function, wrapper) + self.assertTrue(isinstance(instance, wrapt.FunctionWrapper)) + def test_abc_inheritance(self): # XXX The checks commented out below all fail because the # helpers for issubclass() via __subclasscheck__() in ABCMeta @@ -58,7 +70,7 @@ @wrapt.decorator def wrapper(wrapped, instance, args, kwargs): - return wrapped(args, kwargs) + return wrapped(*args, **kwargs) class A1(metaclass=abc.ABCMeta): @abc.abstractmethod @@ -103,6 +115,11 @@ # self.assertTrue(issubclass(C1, (A1, B1, C1, D1))) self.assertTrue(issubclass(D1, (A1, B1, C1, D1))) + self.assertTrue(isinstance(C1(), B1)) + self.assertTrue(isinstance(C1(), C1)) + self.assertTrue(isinstance(D1(), B1)) + self.assertTrue(isinstance(D1(), C1)) + def test_py_abc_inheritance(self): # In contrast to above when C implementation for ABCMeta helpers # are used, these all pass as have use the Python implementation @@ -110,7 +127,7 @@ @wrapt.decorator def wrapper(wrapped, instance, args, kwargs): - return wrapped(args, kwargs) + return wrapped(*args, **kwargs) class A1(metaclass=_py_abc.ABCMeta): @abc.abstractmethod @@ -155,5 +172,10 @@ self.assertTrue(issubclass(C1, (A1, B1, C1, D1))) self.assertTrue(issubclass(D1, (A1, B1, C1, D1))) + self.assertTrue(isinstance(C1(), B1)) + self.assertTrue(isinstance(C1(), C1)) + self.assertTrue(isinstance(D1(), B1)) + self.assertTrue(isinstance(D1(), C1)) + if __name__ == '__main__': unittest.main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_inner_classmethod.py new/wrapt-1.14.1/tests/test_inner_classmethod.py --- old/wrapt-1.13.3/tests/test_inner_classmethod.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_inner_classmethod.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,12 +1,11 @@ from __future__ import print_function import unittest -import inspect import imp import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -95,15 +94,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original.function) - function_argspec = inspect.getargspec(Class.function) + original_argspec = getfullargspec(Original.function) + function_argspec = getfullargspec(Class.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original().function) - function_argspec = inspect.getargspec(Class().function) + original_argspec = getfullargspec(Original().function) + function_argspec = getfullargspec(Class().function) self.assertEqual(original_argspec, function_argspec) def test_class_isinstance(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_inner_staticmethod.py new/wrapt-1.14.1/tests/test_inner_staticmethod.py --- old/wrapt-1.13.3/tests/test_inner_staticmethod.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_inner_staticmethod.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,12 +1,11 @@ from __future__ import print_function import unittest -import inspect import imp import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -95,15 +94,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original.function) - function_argspec = inspect.getargspec(Class.function) + original_argspec = getfullargspec(Original.function) + function_argspec = getfullargspec(Class.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original().function) - function_argspec = inspect.getargspec(Class().function) + original_argspec = getfullargspec(Original().function) + function_argspec = getfullargspec(Class().function) self.assertEqual(original_argspec, function_argspec) def test_class_isinstance(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_instancemethod.py new/wrapt-1.14.1/tests/test_instancemethod.py --- old/wrapt-1.13.3/tests/test_instancemethod.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_instancemethod.py 2022-05-02 06:27:44.000000000 +0200 @@ -6,7 +6,7 @@ import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -95,15 +95,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(OldClass1o.function) - function_argspec = inspect.getargspec(OldClass1d.function) + original_argspec = getfullargspec(OldClass1o.function) + function_argspec = getfullargspec(OldClass1d.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(OldClass1o().function) - function_argspec = inspect.getargspec(OldClass1d().function) + original_argspec = getfullargspec(OldClass1o().function) + function_argspec = getfullargspec(OldClass1d().function) self.assertEqual(original_argspec, function_argspec) def test_getmembers(self): @@ -198,15 +198,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(NewClass1o.function) - function_argspec = inspect.getargspec(NewClass1d.function) + original_argspec = getfullargspec(NewClass1o.function) + function_argspec = getfullargspec(NewClass1d.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(NewClass1o().function) - function_argspec = inspect.getargspec(NewClass1d().function) + original_argspec = getfullargspec(NewClass1o().function) + function_argspec = getfullargspec(NewClass1d().function) self.assertEqual(original_argspec, function_argspec) def test_class_isinstance(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_nested_function.py new/wrapt-1.14.1/tests/test_nested_function.py --- old/wrapt-1.13.3/tests/test_nested_function.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_nested_function.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,12 +1,11 @@ from __future__ import print_function import unittest -import inspect import imp import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -66,8 +65,8 @@ def test_argspec(self): # Test preservation of function argument specification. - function1o_argspec = inspect.getargspec(function1o()) - function1d_argspec = inspect.getargspec(function1d()) + function1o_argspec = getfullargspec(function1o()) + function1d_argspec = getfullargspec(function1d()) self.assertEqual(function1o_argspec, function1d_argspec) def test_isinstance(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_outer_classmethod.py new/wrapt-1.14.1/tests/test_outer_classmethod.py --- old/wrapt-1.13.3/tests/test_outer_classmethod.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_outer_classmethod.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,13 +1,11 @@ from __future__ import print_function -import sys import unittest -import inspect import imp import wrapt -from compat import PY2, PY3, PYXY, exec_ +from compat import PYXY, exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -96,15 +94,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original.function) - function_argspec = inspect.getargspec(Class.function) + original_argspec = getfullargspec(Original.function) + function_argspec = getfullargspec(Class.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original().function) - function_argspec = inspect.getargspec(Class().function) + original_argspec = getfullargspec(Original().function) + function_argspec = getfullargspec(Class().function) self.assertEqual(original_argspec, function_argspec) def test_class_isinstance(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wrapt-1.13.3/tests/test_outer_staticmethod.py new/wrapt-1.14.1/tests/test_outer_staticmethod.py --- old/wrapt-1.13.3/tests/test_outer_staticmethod.py 2021-10-29 22:47:10.000000000 +0200 +++ new/wrapt-1.14.1/tests/test_outer_staticmethod.py 2022-05-02 06:27:44.000000000 +0200 @@ -1,12 +1,11 @@ from __future__ import print_function import unittest -import inspect import imp import wrapt -from compat import PY2, PY3, exec_ +from compat import exec_, getfullargspec DECORATORS_CODE = """ import wrapt @@ -95,15 +94,15 @@ def test_class_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original.function) - function_argspec = inspect.getargspec(Class.function) + original_argspec = getfullargspec(Original.function) + function_argspec = getfullargspec(Class.function) self.assertEqual(original_argspec, function_argspec) def test_instance_argspec(self): # Test preservation of instance method argument specification. - original_argspec = inspect.getargspec(Original().function) - function_argspec = inspect.getargspec(Class().function) + original_argspec = getfullargspec(Original().function) + function_argspec = getfullargspec(Class().function) self.assertEqual(original_argspec, function_argspec) def test_class_isinstance(self):