Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve constants usage / definition in asyncio.windows_events #90396

Closed
sobolevn opened this issue Jan 3, 2022 · 2 comments
Closed

Improve constants usage / definition in asyncio.windows_events #90396

sobolevn opened this issue Jan 3, 2022 · 2 comments
Labels
3.11 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Jan 3, 2022

BPO 46238
Nosy @asvetlov, @1st1, @sobolevn
PRs
  • bpo-46238: reuse _winapi constants in asyncio.windows_events #30352
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-01-04.08:42:55.484>
    created_at = <Date 2022-01-03.09:17:22.518>
    labels = ['3.11', 'type-bug', 'expert-asyncio']
    title = 'Improve constants usage / definition in asyncio.windows_events'
    updated_at = <Date 2022-01-04.08:42:55.484>
    user = 'https://github.com/sobolevn'

    bugs.python.org fields:

    activity = <Date 2022-01-04.08:42:55.484>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-04.08:42:55.484>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2022-01-03.09:17:22.518>
    creator = 'sobolevn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46238
    keywords = ['patch']
    message_count = 2.0
    messages = ['409570', '409653']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'yselivanov', 'sobolevn']
    pr_nums = ['30352']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46238'
    versions = ['Python 3.11']

    @sobolevn
    Copy link
    Member Author

    sobolevn commented Jan 3, 2022

    There are several problems in

    NULL = 0
    INFINITE = 0xffffffff

    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
      def __init__(self, concurrency=0xffffffff):
      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.

    @sobolevn sobolevn added 3.11 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error labels Jan 3, 2022
    @asvetlov
    Copy link
    Contributor

    asvetlov commented Jan 4, 2022

    New changeset 1b11133 by Nikita Sobolev in branch 'main':
    bpo-46238: reuse _winapi constants in asyncio.windows_events (GH-30352)
    1b11133

    @asvetlov asvetlov closed this as completed Jan 4, 2022
    @asvetlov asvetlov closed this as completed Jan 4, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes topic-asyncio type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants