You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example is done with pylint (using pylint 3.3.4, astroid 3.3.8 and Python 3.12.8), but I'm still posting it here because it seems to be astroid-related issue. The most simple reproduction I was able to figure out is with a module that is imported
sayhi.py
print("hello")
def trace():
pass
main.py:
from sayhi import trace
output from pylint main.py is
hello
************* Module main
main.py 1: Unused trace imported from sayhi (unused-import)
The trace here is also name of a module in stdlib, but that should be valid Python code anyway.
Expected outcome is that "hello" is not printed, as sayhi.py shouldn't be imported or executed by astroid (or pylint). That is also the case with astroid 3.3.6.
The text was updated successfully, but these errors were encountered:
@pmustonen any proposed fixes are welcome, I'm assigning myself not to discourage anyone else's contributions, but just to put it on a tinker list for when I might have time.
The frozen module finding logic in astroid >= 3.3.7 (https://github.com/pylint-dev/astroid/blob/main/astroid/interpreter/_import/spec.py#L177) seems to interfere with non-module names that match with names in
sys.stdlib_module_names
.The following example is done with pylint (using pylint 3.3.4, astroid 3.3.8 and Python 3.12.8), but I'm still posting it here because it seems to be astroid-related issue. The most simple reproduction I was able to figure out is with a module that is imported
sayhi.py
main.py:
output from
pylint main.py
isThe
trace
here is also name of a module in stdlib, but that should be valid Python code anyway.Expected outcome is that "hello" is not printed, as
sayhi.py
shouldn't be imported or executed by astroid (or pylint). That is also the case with astroid 3.3.6.The text was updated successfully, but these errors were encountered: