pylint is broken with CPython main
Bug report
pylint currently crashes with CPython main. I noticed this when I noticed the pylint benchmark in Pyston's benchmark suite was no longer working.
The first bad commit is 4a1c58d (@markshannon), issue #96793, PR #98772.
I don't know whether this is the result of expected breakage (and pylint or astroid needs to modify their code) or there is a specialization failure here.
Your environment
Linux
To reproduce
pip install pylint==2.16.2
Download the example Python file from the pyston macrobenchmark suite
pylint dist.py
Backtrace:
Exception on node <Call l.430 at 0x7ff062d76ae0> in file '/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/data/pylint_target/dist.py' Traceback (most recent call last): File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/inference.py", line 450, in infer_subscript assigned = value.getitem(index_value, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/nodes/node_classes.py", line 2466, in getitem raise AstroidIndexError(index) astroid.exceptions.AstroidIndexError: <exception str() failed> The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 91, in walk callback(astroid) File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/pylint/checkers/base/basic_checker.py", line 705, in visit_call if utils.is_terminating_func(node): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/pylint/checkers/utils.py", line 2181, in is_terminating_func return True ^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 171, in infer yield from self._infer(context=context, **kwargs) File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred yield next(generator) ^^^^^^^^^^^^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/decorators.py", line 119, in wrapped yielded.add(ares) File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/inference.py", line 380, in infer_attribute context.boundnode = old_boundnode ^^^^^^^^^^^^^^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 184, in infer for i, result in enumerate(self._infer(context=context, **kwargs)): File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred yield next(generator) ^^^^^^^^^^^^^^^ File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/decorators.py", line 119, in wrapped yielded.add(ares) File "/home/mdboom/Work/builds/python-macrobenchmarks/benchmarks/bm_pylint/venv/lib/python3.12/site-packages/astroid/inference.py", line 458, in infer_subscript raise InferenceError(node=self, context=context) from exc astroid.exceptions.InferenceError: Inference failed for <Subscript l.430 at 0x7ff062d76b40>. ************* Module pylint_target.dist data/pylint_target/dist.py:1:0: C0302: Too many lines in module (1261/1000) (too-many-lines) data/pylint_target/dist.py:22:0: E0401: Unable to import 'distutils.errors' (import-error) data/pylint_target/dist.py:22:0: W4901: Deprecated module 'distutils.errors' (deprecated-module) data/pylint_target/dist.py:22:0: W0401: Wildcard import distutils.errors (wildcard-import) data/pylint_target/dist.py:23:0: E0401: Unable to import 'distutils.fancy_getopt' (import-error) data/pylint_target/dist.py:23:0: W4901: Deprecated module 'distutils.fancy_getopt' (deprecated-module) data/pylint_target/dist.py:24:0: E0401: Unable to import 'distutils.util' (import-error) data/pylint_target/dist.py:24:0: W4901: Deprecated module 'distutils.util' (deprecated-module) data/pylint_target/dist.py:25:0: E0401: Unable to import 'distutils' (import-error) data/pylint_target/dist.py:25:0: W4901: Deprecated module 'distutils' (deprecated-module) data/pylint_target/dist.py:26:0: E0401: Unable to import 'distutils.debug' (import-error) data/pylint_target/dist.py:26:0: W4901: Deprecated module 'distutils.debug' (deprecated-module) data/pylint_target/dist.py:49:0: R0902: Too many instance attributes (27/7) (too-many-instance-attributes) data/pylint_target/dist.py:278:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) data/pylint_target/dist.py:141:4: R0912: Too many branches (18/12) (too-many-branches) data/pylint_target/dist.py:141:4: R0915: Too many statements (60/50) (too-many-statements) data/pylint_target/dist.py:305:8: W0622: Redefining built-in 'dict' (redefined-builtin) data/pylint_target/dist.py:310:4: C0116: Missing function or method docstring (missing-function-docstring) data/pylint_target/dist.py:311:8: C0415: Import outside toplevel (pprint.pformat) (import-outside-toplevel) data/pylint_target/dist.py:328:30: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) data/pylint_target/dist.py:331:30: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) data/pylint_target/dist.py:382:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) data/pylint_target/dist.py:386:4: C0116: Missing function or method docstring (missing-function-docstring) data/pylint_target/dist.py:387:8: C0415: Import outside toplevel (configparser.ConfigParser) (import-outside-toplevel) data/pylint_target/dist.py:410:30: C0209: Formatting a regular string which could be a f-string (consider-using-f-string) data/pylint_target/dist.py:424:12: C2801: Unnecessarily calls dunder method __init__. Instantiate class directly. (unnecessary-dunder-call) data/pylint_target/dist.py:1:0: F0002: data/pylint_target/dist.py: Fatal error while checking 'data/pylint_target/dist.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/home/mdboom/.cache/pylint/pylint-crash-2023-02-14-15-25-33.txt'. (astroid-error) ------------------------------------------------------------------ Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)