You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio has underscored names in its __all__ #134657
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.
Yes, in #128218. I don't see how re-adding them to __all__ under a different name helps backwards compatibility for anyone; it just makes it slightly easier for people to use the private names.
It wasn't for backwards compatibility, it was to reduce the diff when deprecating it, these underscored functions and classes will be removed in 3.16 anyways so making a lot of name changes didn't seem worth it.
Activity
picnixz commentedon May 25, 2025
IIRC, the private names were added when the policy system was being deprecated cc @kumaraditya303 (I don't know if it was meant for bc)
JelleZijlstra commentedon May 25, 2025
Yes, in #128218. I don't see how re-adding them to
__all__under a different name helps backwards compatibility for anyone; it just makes it slightly easier for people to use the private names.pythongh-134657: Remove newly added private names from asyncio.__all__
kumaraditya303 commentedon May 26, 2025
It wasn't for backwards compatibility, it was to reduce the diff when deprecating it, these underscored functions and classes will be removed in 3.16 anyways so making a lot of name changes didn't seem worth it.
JelleZijlstra commentedon Jul 8, 2025
__all__is a public API; we shouldn't be using it to make other changes more convenient.gh-134657: Remove newly added private names from asyncio.__all__ (#13…
pythongh-134657: Remove newly added private names from asyncio.__all__ (
kumaraditya303 commentedon Jul 9, 2025
Okay, I merged your PR.
[3.14] gh-134657: Remove newly added private names from asyncio.__all…
pythongh-134657: Remove newly added private names from asyncio.__all__ (
pythongh-134657: Remove newly added private names from asyncio.__all__ (
pythongh-134657: Remove newly added private names from asyncio.__all__ (
pythongh-134657: Remove newly added private names from asyncio.__all__ (
pythongh-134657: Remove newly added private names from asyncio.__all__ (
[3.14] pythongh-134657: Remove newly added private names from asyncio…