]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353)
authorNikita Sobolev <mail@sobolevn.me>
Tue, 4 Jan 2022 08:44:26 +0000 (11:44 +0300)
committerGitHub <noreply@github.com>
Tue, 4 Jan 2022 08:44:26 +0000 (10:44 +0200)
Lib/asyncio/windows_events.py
Misc/NEWS.d/next/Library/2022-01-03-12-59-20.bpo-46239.ySVSEy.rst [new file with mode: 0644]

index 8c3d73705e3c85bcf8a5b039a349a2a08b9a6940..427d4624ad0764685c1b14e6ab41dce6187ef9dc 100644 (file)
@@ -1,5 +1,10 @@
 """Selector and proactor event loops for Windows."""
 
+import sys
+
+if sys.platform != 'win32':  # pragma: no cover
+    raise ImportError('win32 only')
+
 import _overlapped
 import _winapi
 import errno
diff --git a/Misc/NEWS.d/next/Library/2022-01-03-12-59-20.bpo-46239.ySVSEy.rst b/Misc/NEWS.d/next/Library/2022-01-03-12-59-20.bpo-46239.ySVSEy.rst
new file mode 100644 (file)
index 0000000..202febf
--- /dev/null
@@ -0,0 +1,2 @@
+Improve error message when importing :mod:`asyncio.windows_events` on
+non-Windows.