[stubtest] Error related to __all__ must have it in the error path#14217
[stubtest] Error related to __all__ must have it in the error path#14217hauntsaninja merged 3 commits intomasterfrom
__all__ must have it in the error path#14217Conversation
|
Running Looks like it is fixed! |
There was a problem hiding this comment.
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 |
hauntsaninja
left a comment
There was a problem hiding this comment.
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
stubtestgives 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__.