Skip to content

asyncio has underscored names in its __all__ #134657

Open
@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

asyncio has several names in its __all__ that start with an underscore.

Python 3.15.0a0 (heads/assignannos:9081715ff82, May 25 2025, 08:33:06) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> [x for x in asyncio.__all__ if x.startswith("_")]
['_AbstractEventLoopPolicy', '_get_event_loop_policy', '_set_event_loop_policy', '_set_running_loop', '_get_running_loop', '_register_task', '_unregister_task', '_enter_task', '_leave_task', '_DefaultEventLoopPolicy']

That feels wrong: __all__ indicates the public names in the module, and names that start with an underscore are not meant to be public.

In Python 3.13 there were fewer:

['_set_running_loop', '_get_running_loop', '_register_task', '_unregister_task', '_enter_task', '_leave_task']

I propose we remove the new additions in 3.14 in both the 3.14 and main branches, and remove the remaining underscored names in 3.15.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15new features, bugs and security fixesstdlibPython modules in the Lib dirtopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions