gh-134657: Remove newly added private names from asyncio.__all__ (#134665)

This commit is contained in:
Jelle Zijlstra 2025-07-09 00:55:46 -07:00 committed by GitHub
parent f1dcf3c7bf
commit 797abd1f7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 105 additions and 90 deletions

View file

@ -19,7 +19,7 @@ from test.test_asyncio import utils as test_utils
def tearDownModule():
asyncio._set_event_loop_policy(None)
asyncio.events._set_event_loop_policy(None)
class UpperProto(asyncio.Protocol):
@ -330,16 +330,16 @@ class WinPolicyTests(WindowsEventsTestCase):
async def main():
self.assertIsInstance(asyncio.get_running_loop(), asyncio.SelectorEventLoop)
old_policy = asyncio._get_event_loop_policy()
old_policy = asyncio.events._get_event_loop_policy()
try:
with self.assertWarnsRegex(
DeprecationWarning,
"'asyncio.WindowsSelectorEventLoopPolicy' is deprecated",
):
asyncio._set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.events._set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
finally:
asyncio._set_event_loop_policy(old_policy)
asyncio.events._set_event_loop_policy(old_policy)
def test_proactor_win_policy(self):
async def main():
@ -347,16 +347,16 @@ class WinPolicyTests(WindowsEventsTestCase):
asyncio.get_running_loop(),
asyncio.ProactorEventLoop)
old_policy = asyncio._get_event_loop_policy()
old_policy = asyncio.events._get_event_loop_policy()
try:
with self.assertWarnsRegex(
DeprecationWarning,
"'asyncio.WindowsProactorEventLoopPolicy' is deprecated",
):
asyncio._set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
asyncio.events._set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
asyncio.run(main())
finally:
asyncio._set_event_loop_policy(old_policy)
asyncio.events._set_event_loop_policy(old_policy)
if __name__ == '__main__':