stubtest: __all__
check seems to ignore *.allowlist
files
#17277
Labels
bug
mypy got something wrong
__all__
check seems to ignore *.allowlist
files
#17277
Bug Report
mypy stubtest
started failing oncontextlib2
a while back, and I'm finally getting around to trying to fix it. Most of the issues have been resolved just by updating the stub to the latest version from typeshed (with the appropriate edits forcontextlib2
), but I had trouble getting this error to go away:For the specific case of
contextlib2
, I was able to resolve it by just droppingContextStack
from the runtime__all__
(it's a long-deprecated API that nobody should be using at all, let alone viaimport *
), but it seems wrong that the warning was emitted at all given thatcontextlib2.ContextStack
is listed in https://github.com/jazzband/contextlib2/blob/master/dev/mypy.allowlist (at least, it was when I was getting this error. I commented it out later after mypy complained that the entry wasn't needed anymore - it may be that mypy's type inferencing has improved to the point where it can now derive theContextStack
method signatures from theExitStack
ones)Adding
ContextStack
just to__all__
in the stub without adding an actual spec for it didn't make the error go away.Expected Behavior
Listing
contextlib2.ContextStack
in themypy.allowlist
file would makemypy
never care about that name, including in the__all__
check.Actual Behavior
__all__
error as shown aboveYour Environment
mypy 1.8.0 (compiled: no)
python -m mypy.stubtest --allowlist dev/mypy.allowlist contextlib2
mypy.ini
(and other config files): defaults (no config files)The text was updated successfully, but these errors were encountered: