-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergablepython 3.10
Description
Bug description
when a project holds a module name that shadows builtin module name, pylist fails on no-member
, when clearly this is not the case.
reproduction
given 2 files:
os.py
an empty filetest.py
with the following content"""test.py""" import os print(os.environ['SHELL'])
and now pylint fails on no-member
as follows
$ pylint **/*.py
************* Module test
test.py:4:6: E1101: Module 'os' has no 'environ' member (no-member)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
but the code is correct
$ python test.py
/usr/local/bin/bash
Configuration
No response
Command used
pylint **/*.py
Pylint output
************* Module test
test.py:4:6: E1101: Module 'os' has no 'environ' member (no-member)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Expected behavior
pylint should be aware of the import
tree, and report such issue if that is indeed the case.
in the reproduction snippet above, test.py
imports the os
builtin module (and not os.py
) that has the environ()
.
Pylint version
pylint 2.13.8
astroid 2.11.4
Python 3.10.3 (main, Mar 17 2022, 09:46:58) [Clang 13.1.6 (clang-1316.0.21.2)]
OS / Environment
macos
$ sw_vers
ProductName: macOS
ProductVersion: 12.3.1
BuildVersion: 21E258
Additional dependencies
No response
ssbarnea, ianjirka, sylr, jeohist, aciba90 and 3 morepierrecdn
Metadata
Metadata
Assignees
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid updateNeeds an astroid update (probably a release too) before being mergableNeeds an astroid update (probably a release too) before being mergablepython 3.10