This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incosistent error message in asyncio: windows_events / windows_utils
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, miss-islington, sobolevn, yselivanov
Priority: normal Keywords: patch

Created on 2022-01-03 09:58 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30353 merged sobolevn, 2022-01-03 10:02
PR 30388 merged miss-islington, 2022-01-04 08:45
PR 30389 merged miss-islington, 2022-01-04 08:45
Messages (4)
msg409571 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-03 09:58
When trying to import both `windows_events` and `windows_utils` on non-Windows, they both fail.

But, they fail differently. `windows_utils` produces a good error message, whil `windows_events` produces a strange one.

Good:

```
Python 3.11.0a3+ (heads/main:8d7644fa64, Dec 30 2021, 13:00:40) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio.windows_utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sobolev/Desktop/cpython/Lib/asyncio/windows_utils.py", line 6, in <module>
    raise ImportError('win32 only')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: win32 only
```

Not so good:

```
>>> import asyncio.windows_events
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sobolev/Desktop/cpython/Lib/asyncio/windows_events.py", line 3, in <module>
    import _overlapped
    ^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_overlapped'
```

I propose to use the same error message `windows_utils` does.
msg409654 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-04 08:44
New changeset 5a2a65096c3ec2d37f33615f2a420d2ffcabecf2 by Nikita Sobolev in branch 'main':
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353)
https://github.com/python/cpython/commit/5a2a65096c3ec2d37f33615f2a420d2ffcabecf2
msg409656 - (view) Author: miss-islington (miss-islington) Date: 2022-01-04 09:14
New changeset 86d1b8c13fcaf8a974cf2ae23b31fe87dfdb6267 by Miss Islington (bot) in branch '3.9':
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353)
https://github.com/python/cpython/commit/86d1b8c13fcaf8a974cf2ae23b31fe87dfdb6267
msg409657 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-04 09:22
New changeset cf48a148190a6ccadc144cab2e2046e95c20fb57 by Miss Islington (bot) in branch '3.10':
bpo-46239: improve error message when importing `asyncio.windows_events` (GH-30353) (#30388)
https://github.com/python/cpython/commit/cf48a148190a6ccadc144cab2e2046e95c20fb57
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90397
2022-01-04 09:22:46asvetlovsetmessages: + msg409657
2022-01-04 09:22:40asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-04 09:14:16miss-islingtonsetmessages: + msg409656
2022-01-04 08:45:47miss-islingtonsetpull_requests: + pull_request28598
2022-01-04 08:45:42miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28597
2022-01-04 08:44:37asvetlovsetmessages: + msg409654
2022-01-03 10:02:01sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28566
2022-01-03 09:58:19sobolevncreate