Closed
Description
Bug description
When parsing the following file:
try:
raise ExceptionGroup("test", [ValueError("value error")])
except* ValueError:
print("hello")
pylint crashed with a AstroidBuildingError
and with the following stacktrace:
Traceback (most recent call last):
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1026, in get_ast
return MANAGER.ast_from_file(filepath, modname, source=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/manager.py", line 124, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/builder.py", line 144, in file_build
module, builder = self._data_build(data, modname, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/builder.py", line 204, in _data_build
module = builder.visit_module(node, modname, node_file, package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 254, in visit_module
[self.visit(child, newnode) for child in node.body],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 254, in <listcomp>
[self.visit(child, newnode) for child in node.body],
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 603, in visit
visit_method = getattr(self, visit_name)
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeRebuilder' object has no attribute 'visit_trystar'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 718, in _get_asts
ast_per_fileitem[fileitem] = self.get_ast(
^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1048, in get_ast
raise astroid.AstroidBuildingError(
astroid.exceptions.AstroidBuildingError: Building error when trying to create ast representation of module 'test'
Configuration
No response
Command used
pylint test.py
Pylint output
pylint does not have any successful output, just a crash report (which I copy-pasted into the bug description above). For completeness, I'll paste the raw output here as well:
Traceback (most recent call last):
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1026, in get_ast
return MANAGER.ast_from_file(filepath, modname, source=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/manager.py", line 124, in ast_from_file
return AstroidBuilder(self).file_build(filepath, modname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/builder.py", line 144, in file_build
module, builder = self._data_build(data, modname, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/builder.py", line 204, in _data_build
module = builder.visit_module(node, modname, node_file, package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 254, in visit_module
[self.visit(child, newnode) for child in node.body],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 254, in <listcomp>
[self.visit(child, newnode) for child in node.body],
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tor/oda/trex/.venv/lib/python3.11/site-packages/astroid/rebuilder.py", line 603, in visit
visit_method = getattr(self, visit_name)
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeRebuilder' object has no attribute 'visit_trystar'
************* Module test
test.py:1:0: F0002: test.py: Fatal error while checking 'test.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/Users/tor/Library/Caches/pylint/pylint-crash-2023-02-24-12-49-59.txt'. (astroid-error)
Expected behavior
No crash expected
Pylint version
pylint 2.16.2
astroid 2.14.2
Python 3.11.1 (main, Jan 10 2023, 15:10:23) [Clang 14.0.0 (clang-1400.0.29.202)]
OS / Environment
macOS. uname -v
yields
Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64
Additional dependencies
No response