[New-bugs-announce] [issue46238] Improve constants usage / definition in asyncio.windows_events

Nikita Sobolev report at bugs.python.org
Mon Jan 3 04:17:22 EST 2022

New submission from Nikita Sobolev <mail at sobolevn.me>:

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.

components: asyncio
messages: 409570
nosy: asvetlov, sobolevn, yselivanov
priority: normal
severity: normal
status: open
title: Improve constants usage / definition in asyncio.windows_events
type: behavior
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list