Opened 8 months ago
Closed 8 months ago
#69533 closed defect (fixed)
py311-pylint @3.0.3_1: fails with astroid.exceptions.StatementMissing since py311-astroid @3.1.0_0 update
Reported by: | saj (Saj Goonatilleke) | Owned by: | saj (Saj Goonatilleke) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.9.1 |
Keywords: | Cc: | stromnov (Andrey Stromnov) | |
Port: | py-pylint py311-pylint |
Description
possible regression from py-astroid: update to 3.1.0
The problem may be reproduced by invoking pylint
on the following simple program.
#!/usr/bin/env python3 # pylint: disable=missing-module-docstring if __name__ == "__main__": print("hello")
pylint fails with the following error message.
% pylint testprog Exception on node <Name.__name__ l.5 at 0x106ce2d90> in file '/Users/saj/s/stash/shstash-xNs1kEr9/testprog' Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 91, in walk callback(astroid) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pylint/checkers/variables.py", line 1642, in visit_name self._loopvar_name(node) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pylint/checkers/variables.py", line 2550, in _loopvar_name if astmts[i].statement().parent_of(stmt) and not utils.in_for_else_branch( ^^^^^^^^^^^^^^^^^^^^^ File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 297, in statement return self.parent.statement() ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 414, in statement raise StatementMissing(target=self) astroid.exceptions.StatementMissing: Statement not found on <Module.testprog l.0 at 0x1060d1d10> ************* Module testprog testprog:1:0: F0002: testprog: Fatal error while checking 'testprog'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/Users/saj/Library/Caches/pylint/pylint-crash-2024-03-18-21-18-55.txt'. (astroid-error)
https://github.com/pylint-dev/pylint/blob/v3.0.3/pyproject.toml#L44
dependencies = [ # ... "astroid>=3.0.1,<=3.1.0-dev0", ]
I think this is a conflict introduced by MacPorts: either pylint should be updated to 3.1.0 (probably preferable), or the bump to astroid should be reverted.
% port echo installed | grep -E 'astroid|pylint' py311-astroid @3.1.0_0 py311-pylint @3.0.3_1 pylint_select @0.1_2 % pylint --version pylint 3.0.3 astroid 3.1.0 Python 3.11.8 (main, Feb 10 2024, 20:48:19) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Using a clone of the macports source tree, I reverted py311-astroid back to @3.0.3_0 and confirmed the problem went away.
Change History (2)
comment:1 Changed 8 months ago by saj (Saj Goonatilleke)
comment:2 Changed 8 months ago by saj (Saj Goonatilleke)
Owner: | set to saj |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
I don't really know what I'm doing but here is a patch if it will help. :)
https://github.com/macports/macports-ports/pull/23087