-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
import-self
only compares the name of a module and doesn't consider the actual module being imported
#7289
Comments
i don't think that conclusion is correct. being able to lint programs doesn't mean they have to be registered as importable modules. |
Thanks, I was having trouble understanding what you meant by "registered as an importable module." Do you mean In that case, having had a look at fac0b37, I guess we do have a flag we could check to see if this "was just some file" and not something importable ending in .py. (Although with some effort you could still import it, that's not relevant here, since a user who takes great effort to do that is probably not going to complain if we make If you don't mind, I'll retitle the issue to focus on |
import-self
emitted when a script does not end in .py
(not importable)
Regarding the |
Maybe we should close #5151 in favor of this one and broaden the scope back out to all the other module-related checks ( |
as long as the issue is resolved (where a program cannot poison the set of importable modules), i'm fine with any approach |
@jacobtylerwalls Did you look at the code already?
Which returns the
That's just two strings being compared. Although |
Some very relevant (and funny in hindsight) comments: Currently relevant code is stored here: Edit: Found a fix 😄 Publishing PR to |
import-self
emitted when a script does not end in .py
(not importable)import-self
only compares the name of a module and doesn't consider the actual module being imported
This issue has been slightly rescoped, see #5151 (comment). The issue about importing the correct module has been fixed and we should now follow this up in Edit: A potential fix should also consider the following edge case and fix it: #7289 |
Bug description
Configuration
No response
Command used
Pylint output
Expected behavior
pylint shouldn't think a program named "foo" can be imported as "foo" when it doesn't have a .py extension
Pylint version
OS / Environment
Linux
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: