powerline / powerline

Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.

Home Page:https://powerline.readthedocs.org/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Powerline uses deprecated function `inspect.formatargspec()` to be removed in Python 3.11

sicherha opened this issue · comments

The Fedora project is experimenting with early Python 3.11 pre-release builds. In these experiments, the powerline package - specifically its documentation - fails to build from source because a script tries to import the deprecated function inspect.formatargspec(). That function is removed in Python 3.11.

Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2022396

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/sphinx/registry.py", line 429, in load_extension
    mod = import_module(extname)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 897, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/builddir/build/BUILD/powerline-2.8.2/docs/source/powerline_autodoc.py", line 6, in <module>
    from inspect import formatargspec
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

Here's the offending import:

from inspect import formatargspec

The Python documentation recommends replacing the ArgSpec functionality with signature() and signature objects: https://docs.python.org/3.10/library/inspect.html?highlight=formatargspec#inspect.formatargspec
This looks like it may require a bit of refactoring.