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: Improve constants usage / definition in asyncio.windows_events
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, sobolevn, yselivanov
Priority: normal Keywords: patch

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

Pull Requests
URL Status Linked Edit
PR 30352 merged sobolevn, 2022-01-03 09:20
Messages (2)
msg409570 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-03 09:17
There are several problems in https://github.com/python/cpython/blob/549e62827262264cda30455e10e315602129da72/Lib/asyncio/windows_events.py#L31-L32

1. For some reason this module uses both `NULL` and `_winapi.NULL`, `INFINITE` and `_winapi.INFINITE`. There's no system to it. Besides, they are have equal values. I think it better to use aliases to `_winapi` constants than redefine them
2. Here https://github.com/python/cpython/blob/549e62827262264cda30455e10e315602129da72/Lib/asyncio/windows_events.py#L408 `INFINITE` is not used, but should. It would increase readability. Compare:

- `def __init__(self, concurrency=0xffffffff):` < not clear
- `def __init__(self, concurrency=INFINITE):` < clear

The PR is on its way.
msg409653 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-04 08:42
New changeset 1b111338cfe7840feea95e30ea8124063c450c65 by Nikita Sobolev in branch 'main':
bpo-46238: reuse `_winapi` constants in `asyncio.windows_events` (GH-30352)
https://github.com/python/cpython/commit/1b111338cfe7840feea95e30ea8124063c450c65
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90396
2022-01-04 08:42:55asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-04 08:42:34asvetlovsetmessages: + msg409653
2022-01-03 09:20:21sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28565
2022-01-03 09:17:22sobolevncreate