-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Change in behavior with __import__('pkgutil').extend_path() # type: Iterable[str] #7582
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
Comments
The root cause is in python/typeshed#3188, which was incorporated into mypy 0.730. Before that PR, I'm thinking that maybe this should be rolled back -- it doesn't make sense to try and do strict type checking on the module returned by @srittau @ilevkivskyi @JukkaL Thoughts? |
I am fine either way. Short term we can set it back to |
@ericvw If you can submit a PR to typeshed to change the return type of |
I think making it return |
So I'm going to close this issue, but I would merge a typeshed PR to change the return type of |
I have created python/typeshed#3383. Thanks! |
From python/mypy#7582. This partially reverts back the change in 0ee7c3c to have `__import__` return `Any` instead of `ModuleType`.
I'm having the same behavior in my
and |
Same with |
Is there a workaround for this that doesn't require annotating every |
The last two comments seem to be about an unrelated issue. This issue is only about the type returned by ‘import’. |
Ah, looks like we're complaining specifically about |
I noticed a change in behavior between versions 0.720 and 0.730 when using
pkgutil
-style namespace packages.For the following
__init__.py
file:mypy == 0.720
will report:Thus, I "resolved" this with the following in, in
0.720
:With
mypy ==0.730
, I get the following:When researching this issue, #7501 (comment) indicates that
__import__
is not followed. However, I don't fully understand the change in behavior and had trouble usinggit-bisect
to narrow it down.The text was updated successfully, but these errors were encountered: