[MacPorts] #69533: py311-pylint @3.0.3_1: fails with astroid.exceptions.StatementMissing since py311-astroid @3.1.0_0 update
MacPorts
noreply at macports.org
Mon Mar 18 11:02:39 UTC 2024
#69533: py311-pylint @3.0.3_1: fails with astroid.exceptions.StatementMissing since
py311-astroid @3.1.0_0 update
--------------------+------------------------------------
Reporter: saj | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.9.1
Keywords: | Port: py-pylint py311-pylint
--------------------+------------------------------------
possible regression from
[changeset:4fac663bd99bc4571e9dac13c1707c7a380d0098/macports-ports 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.
--
Ticket URL: <https://trac.macports.org/ticket/69533>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list