-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[stubtest] Error related to __all__
must have it in the error path
#14217
Conversation
Running
Looks like it is fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check verifies that the publicly exported names are the same in the stub as at runtime. That's not exactly the same as verifying that __all__
is the same in the stub as at runtime (though having an inaccurate __all__
is the most likely cause of the error).
E.g. I believe you'll also get this error emitted if __all__
in the stub is accurate, but something is missing from the stub (despite being included in __all__
in the stub). In that situation, it might not be so appropriate to have __all__
in the error path.
I've recreated it:
It looks fine to me, much better than ignoring the whole module. |
To be clear, if you have an allowlist entry of
Having said that, I agree that the current situation isn't ideal, and you're right that it doesn't look as confusing as I worried it might do if we add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this seems reasonable.
(I guess the other thing we could do is emit a single error for each name, but that could result in similar allowlisting issues for specific defs)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Since python/mypy#14217 is merged
Right now
stubtest
gives this error for__all__
:(Context: there's a real error in
__all__
: https://foss.heptapod.net/python-libs/passlib/-/blob/branch/stable/passlib/handlers/oracle.py#L18)The only way to ignore it is to ignore the whole module. This is not right.
We need to be able to ignore just
some_module.__all__
.