Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash - AstroidError under Python 3.12.0a7; raise_if_nothing_inferred #8804

Closed
jnsnow opened this issue Jun 28, 2023 · 3 comments
Closed

Crash - AstroidError under Python 3.12.0a7; raise_if_nothing_inferred #8804

jnsnow opened this issue Jun 28, 2023 · 3 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue python 3.12 Upstream Bug 🪲 Bug in a dependency of pylint that is not astroid

Comments

@jnsnow
Copy link
Contributor

jnsnow commented Jun 28, 2023

Bug description

Pylint 2.17.4 fatally crashes when checking the following minimal reproducer under Python 3.12.0a7:

class Reproducer:
    def foo(self) -> None:
        return self.bar()

    def baz(self) -> None:
        return self.xyzzy()

Version information:

Other information:

I am seeing this crash on production code that checks fine under mypy/pylint from Python 3.7 through 3.11 inclusive; it's only under Python 3.12 that pylint alone crashes. This reproducer is as small as I could get it while still seeing the crash. I unfortunately couldn't find a minimal reproducer for code that I believed "should work"; the code in question that prompted this bug report can be found at https://gitlab.com/qemu-project/python-qemu-qmp/-/blob/main/qemu/qmp/protocol.py

(If you clone the repo and have Python 3.12 available and type "make check-tox", you should be able to see it fail on the production code for yourself.)

Configuration

No response

Command used

`pylint reproducer.py`

Pylint output

pylint crashed with a ``AstroidError`` and with the following stacktrace:

Traceback (most recent call last):
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/astroid/decorators.py", line 143, in raise_if_nothing_inferred
    yield next(generator)
          ^^^^^^^^^^^^^^^
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 811, in _lint_file
    check_astroid_module(module)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 1085, in check_astroid_module
    retval = self._check_astroid_module(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 1135, in _check_astroid_module
    walker.walk(node)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  [Previous line repeated 1 more time]
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/checkers/base/basic_checker.py", line 713, in visit_call
    if utils.is_terminating_func(node):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/checkers/utils.py", line 2202, in is_terminating_func
    return True
           ^^^^
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 171, in infer
    yield from self._infer(context=context, **kwargs)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/astroid/decorators.py", line 149, in raise_if_nothing_inferred
    raise InferenceError(
astroid.exceptions.InferenceError: StopIteration raised without any error information.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 775, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "/home/jsnow/src/qemu.qmp/.tox/py312/lib/python3.12/site-packages/pylint/lint/pylinter.py", line 813, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError


### Expected behavior

Pylint shouldn't crash.

### Pylint version

```shell
pylint 2.17.4
astroid 2.15.5
Python 3.12.0a7 (main, Apr  5 2023, 00:00:00) [GCC 13.0.1 20230401 (Red Hat 13.0.1-0)]

OS / Environment

Fedora 38

Additional dependencies

No response

@jnsnow jnsnow added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 28, 2023
@jacobtylerwalls
Copy link
Member

Thanks for the report. Duplicate of #8695 (fixed upstream in subsequent CPython releases). Keep the 3.12 issues coming! :-)

@jacobtylerwalls jacobtylerwalls closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue Upstream Bug 🪲 Bug in a dependency of pylint that is not astroid and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 28, 2023
@jnsnow
Copy link
Contributor Author

jnsnow commented Jun 28, 2023

Thanks for the report. Duplicate of #8695 (fixed upstream in subsequent CPython releases). Keep the 3.12 issues coming! :-)

Whoops, missed that one. I've upgraded to 0b3 and pylint is still eating dirt, but differently. Let me go back to the kitchen and cook up a new repro. :)

@jacobtylerwalls
Copy link
Member

Sounds good. (Make sure to be aware of #8782.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue python 3.12 Upstream Bug 🪲 Bug in a dependency of pylint that is not astroid
Projects
None yet
Development

No branches or pull requests

2 participants