Mark several asyncio modules as Windows-only#6796
Conversation
This comment has been minimized.
This comment has been minimized.
| class Executor: | ||
| if sys.version_info >= (3, 9): | ||
| def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... | ||
| def submit(self, __fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ... |
There was a problem hiding this comment.
This is unrelated, sorry. I will remove it shortly.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Ok, looks like the order of mypy_primer output is broken. It seems like this #6796 (comment) is the last one. |
|
I will try to reopen this PR. |
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
Yeap, I was right 🙂 |
srittau
left a comment
There was a problem hiding this comment.
These files exist on Linux at least and have all definitions. I don't think we should guard this behind platform checks, even if this doesn't work on non-Windows platforms. For example, I wouldn't want code like the following, which works at runtime, fail during typecheck:
from asyncio.unix_events import SelectorEventLoop
from asyncio.windows_events import ProactorEventLoop
if sys.platform == "win32":
loop = ProactorEventLoop
else:
loop = SelectorEventLoop
This code does not work in runtime. It fails with Explicit check for So, typechecking is correct here. It should be: if sys.platform == "win32":
from asyncio.windows_events import ProactorEventLoop
loop = ProactorEventLoop
else:
from asyncio.unix_events import SelectorEventLoop
loop = SelectorEventLoop |
|
@srittau thank you! 🙂 |
It happens because both modules import
_winapiwhich is marked as Windows-only.