From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:13:56 +0000 (-0800) Subject: bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353) X-Git-Tag: v3.9.10~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86d1b8c13fcaf8a974cf2ae23b31fe87dfdb6267;p=thirdparty%2FPython%2Fcpython.git bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353) (cherry picked from commit 5a2a65096c3ec2d37f33615f2a420d2ffcabecf2) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py index 5e7cd795895d..da81ab435b9a 100644 --- a/Lib/asyncio/windows_events.py +++ b/Lib/asyncio/windows_events.py @@ -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 index 000000000000..202febf84fd1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-03-12-59-20.bpo-46239.ySVSEy.rst @@ -0,0 +1,2 @@ +Improve error message when importing :mod:`asyncio.windows_events` on +non-Windows.