-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False "import-self" when importing a package from stdlib with same name than local subpackage #3665
Comments
It is a reference to itself. Try it! |
Why? It is an absolute import. It is referencing the standard library |
@Pierre-Sassoulas I cannot reproduce this. Might have been fixed! |
I've experienced the same (or a very similar) issue.
My circumstances are more or less identical: I have a file named Upon running As far as I can tell, the only way to resolve this is to either disable the warning or rename the file. |
I just got this too, not sure if regression:
In my case my file is called from falcon.http_error import HTTPError which causes it too, so not limited to stdlib. |
Confirmed for:
Running I have |
@dubiousjim is the situation any different with pylint-dev/astroid#2223? |
@jacobtylerwalls No that doesn't fix it. I checked out the branch linked in that pull request (specifically commit 849f68e0), built the package and installed in my sys.path. And moved my distro's
I left my existing |
Build steps:
Then disable my distro's copy of |
Got it, appreciate you finding out and reporting back. |
I just now noticed that if a package (file or directory containing |
Here's a more exhaustive detailing of when the issue does/doesn't arise:
|
I have a package named
logging
, which is inside a namespace package (python 3.0 style)in
__init__.py
Here,
logging
refers to the std library. But, pylint is givingW0406: import-self
for the statement.Steps to reproduce
python -m pylint src/bar/logging/__init__.py
Current behavior
Expected behavior
No error because
logging
is not a reference to itself.pylint --version output
The text was updated successfully, but these errors were encountered: