|
16 | 16 | from contextvars import copy_context
|
17 | 17 | from math import inf
|
18 | 18 | from time import perf_counter
|
| 19 | +from typing import TYPE_CHECKING, Any |
19 | 20 |
|
20 | 21 | from sniffio import current_async_library_cvar
|
21 | 22 |
|
@@ -582,7 +583,7 @@ def shield(self):
|
582 | 583 | """
|
583 | 584 | return self._shield
|
584 | 585 |
|
585 |
| - @shield.setter |
| 586 | + @shield.setter # type: ignore # "decorated property not supported" |
586 | 587 | @enable_ki_protection
|
587 | 588 | def shield(self, new_value):
|
588 | 589 | if not isinstance(new_value, bool):
|
@@ -1150,7 +1151,7 @@ class GuestState:
|
1150 | 1151 | run_sync_soon_not_threadsafe = attr.ib()
|
1151 | 1152 | done_callback = attr.ib()
|
1152 | 1153 | unrolled_run_gen = attr.ib()
|
1153 |
| - unrolled_run_next_send = attr.ib(factory=lambda: Value(None)) |
| 1154 | + unrolled_run_next_send = attr.ib(factory=lambda: Value(None), type=object) |
1154 | 1155 |
|
1155 | 1156 | def guest_tick(self):
|
1156 | 1157 | try:
|
@@ -2311,13 +2312,17 @@ async def checkpoint_if_cancelled():
|
2311 | 2312 | task._cancel_points += 1
|
2312 | 2313 |
|
2313 | 2314 |
|
2314 |
| -if os.name == "nt": |
| 2315 | +if sys.platform == "win32": |
2315 | 2316 | from ._io_windows import WindowsIOManager as TheIOManager
|
2316 | 2317 | from ._generated_io_windows import *
|
2317 |
| -elif hasattr(select, "epoll"): |
| 2318 | +elif sys.platform == "linux" or (not TYPE_CHECKING and hasattr(select, "epoll")): |
2318 | 2319 | from ._io_epoll import EpollIOManager as TheIOManager
|
2319 | 2320 | from ._generated_io_epoll import *
|
2320 |
| -elif hasattr(select, "kqueue"): |
| 2321 | +elif ( |
| 2322 | + sys.platform == "darwin" |
| 2323 | + or sys.platform.startswith("freebsd") |
| 2324 | + or (not TYPE_CHECKING and hasattr(select, "epoll")) |
| 2325 | +): |
2321 | 2326 | from ._io_kqueue import KqueueIOManager as TheIOManager
|
2322 | 2327 | from ._generated_io_kqueue import *
|
2323 | 2328 | else: # pragma: no cover
|
|
0 commit comments