Skip to content

Commit a73a028

Browse files
authored
Attempt to fix for Android's sys.platform changes (#3359)
* Attempt to fix for Android * Add a newsfragment
1 parent 18fd1d4 commit a73a028

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

newsfragments/3357.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Start supporting Android's new ``"android"`` `sys.platform`.

src/trio/_core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686
write_overlapped,
8787
)
8888
# Kqueue imports
89-
if (sys.platform != "linux" and sys.platform != "win32") or (
90-
not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules
91-
):
89+
if (
90+
sys.platform != "linux" and sys.platform != "win32" and sys.platform != "android"
91+
) or (not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules):
9292
from ._run import current_kqueue, monitor_kevent, wait_kevent
9393

9494
del sys # It would be better to import sys as _sys, but mypy does not understand it

src/trio/_core/_run.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,11 @@ def in_trio_task() -> bool:
31133113
WindowsIOManager as TheIOManager,
31143114
_WindowsStatistics as IOStatistics,
31153115
)
3116-
elif sys.platform == "linux" or (not TYPE_CHECKING and hasattr(select, "epoll")):
3116+
elif (
3117+
sys.platform == "linux"
3118+
or sys.platform == "android"
3119+
or (not TYPE_CHECKING and hasattr(select, "epoll"))
3120+
):
31173121
from ._generated_io_epoll import *
31183122
from ._io_epoll import (
31193123
EpollIOManager as TheIOManager,

0 commit comments

Comments
 (0)