Bug 2034943

Summary: python-asttokens fails to build with Python 3.11: ImportError: cannot import name 'formatargspec' from 'inspect'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-asttokensAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: mhroncok, thrnciar, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-asttokens-2.0.5-6.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-27 20:57:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2022393    
Bug Blocks: 2016048    

Description Tomáš Hrnčiar 2021-12-22 14:33:26 UTC
python-asttokens fails to build with Python 3.11.0a3.

==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_astroid.py ____________________
ImportError while importing test module '/builddir/build/BUILD/asttokens-2.0.5/tests/test_astroid.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_astroid.py:4: in <module>
    import astroid
/usr/lib/python3.11/site-packages/astroid/__init__.py:51: in <module>
    from astroid.nodes import node_classes, scoped_nodes
/usr/lib/python3.11/site-packages/astroid/nodes/__init__.py:27: in <module>
    from astroid.nodes.node_classes import (  # pylint: disable=redefined-builtin (Ellipsis)
/usr/lib/python3.11/site-packages/astroid/nodes/node_classes.py:47: in <module>
    from astroid import decorators, mixins, util
/usr/lib/python3.11/site-packages/astroid/decorators.py:27: in <module>
    import wrapt
/usr/lib64/python3.11/site-packages/wrapt/__init__.py:10: in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
/usr/lib64/python3.11/site-packages/wrapt/decorators.py:34: in <module>
    from inspect import ismethod, isclass, formatargspec
E   ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)
__________________ ERROR collecting tests/test_mark_tokens.py __________________
ImportError while importing test module '/builddir/build/BUILD/asttokens-2.0.5/tests/test_mark_tokens.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_mark_tokens.py:15: in <module>
    import astroid
/usr/lib/python3.11/site-packages/astroid/__init__.py:51: in <module>
    from astroid.nodes import node_classes, scoped_nodes
/usr/lib/python3.11/site-packages/astroid/nodes/__init__.py:27: in <module>
    from astroid.nodes.node_classes import (  # pylint: disable=redefined-builtin (Ellipsis)
/usr/lib/python3.11/site-packages/astroid/nodes/node_classes.py:47: in <module>
    from astroid import decorators, mixins, util
/usr/lib/python3.11/site-packages/astroid/decorators.py:27: in <module>
    import wrapt
/usr/lib64/python3.11/site-packages/wrapt/__init__.py:10: in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
/usr/lib64/python3.11/site-packages/wrapt/decorators.py:34: in <module>
    from inspect import ismethod, isclass, formatargspec
E   ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)
_____________________ ERROR collecting tests/test_util.py ______________________
ImportError while importing test module '/builddir/build/BUILD/asttokens-2.0.5/tests/test_util.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_util.py:6: in <module>
    import astroid
/usr/lib/python3.11/site-packages/astroid/__init__.py:51: in <module>
    from astroid.nodes import node_classes, scoped_nodes
/usr/lib/python3.11/site-packages/astroid/nodes/__init__.py:27: in <module>
    from astroid.nodes.node_classes import (  # pylint: disable=redefined-builtin (Ellipsis)
/usr/lib/python3.11/site-packages/astroid/nodes/node_classes.py:47: in <module>
    from astroid import decorators, mixins, util
/usr/lib/python3.11/site-packages/astroid/decorators.py:27: in <module>
    import wrapt
/usr/lib64/python3.11/site-packages/wrapt/__init__.py:10: in <module>
    from .decorators import (adapter_factory, AdapterFactory, decorator,
/usr/lib64/python3.11/site-packages/wrapt/decorators.py:34: in <module>
    from inspect import ismethod, isclass, formatargspec
E   ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)
=========================== short test summary info ============================
ERROR tests/test_astroid.py
ERROR tests/test_mark_tokens.py
ERROR tests/test_util.py
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 3 errors in 0.27s ===============================

Removed from the inspect module:
    the getargspec function, deprecated since Python 3.0; use inspect.signature() or inspect.getfullargspec() instead.
    the formatargspec function, deprecated since Python 3.5; use the inspect.signature() function and Signature object directly.
    the undocumented Signature.from_callable and Signature.from_function functions, deprecated since Python 3.5; use the Signature.from_callable() method instead.
(Contributed by Hugo van Kemenade in bpo-45320.)

<https://bugs.python.org/issue45320
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03071840-python-asttokens/

For all our attempts to build python-asttokens with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-asttokens/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Ben Cotton 2022-02-08 21:19:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 2 Zbigniew Jędrzejewski-Szmek 2022-04-24 14:15:47 UTC
Unfortunately asttokens requires old astroid: https://github.com/gristlabs/asttokens/issues/79
This will need some fixes upstream.

Comment 3 Fedora Update System 2022-04-27 20:55:43 UTC
FEDORA-2022-26a7d8581b has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-26a7d8581b

Comment 4 Fedora Update System 2022-04-27 20:57:23 UTC
FEDORA-2022-26a7d8581b has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.