]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 4 Jan 2022 09:13:56 +0000 (01:13 -0800)
committerGitHub <noreply@github.com>
Tue, 4 Jan 2022 09:13:56 +0000 (01:13 -0800)
(cherry picked from commit 5a2a65096c3ec2d37f33615f2a420d2ffcabecf2)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
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 5e7cd795895d65456dc8a372421c8cc29c046bcd..da81ab435b9a6ffcda41ebe5fdacc4e9b5836cc2 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.