[New-bugs-announce] [issue32269] Add `asyncio.get_running_loop()` function

Yury Selivanov report at bugs.python.org
Sun Dec 10 12:08:44 EST 2017


New submission from Yury Selivanov <yselivanov at gmail.com>:

In many contexts `asyncio._get_running_loop()` is more useful than `asyncio.get_event_loop()`.  The former function is predictable and simple, the latter can change its behaviour depending on the current policy and can even create new event loops.

Both `asyncio._get_running_loop()` and `asyncio._set_running_loop()` are public asyncio API, although the leading underscore suggests that they are special and shouldn't be used by regular users.  That's true for `asyncio._set_running_loop()`, which is intended to be used by event loops exclusively.

I propose to remove the leading underscore from `asyncio._get_running_loop()`, making it `asyncio.get_running_loop()`, and thus promoting a safer alternative to `asyncio.get_event_loop()`.

`asyncio._get_running_loop()` will be deprecated and removed in Python 3.9.

----------
assignee: yselivanov
messages: 307961
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add `asyncio.get_running_loop()` function

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32269>
_______________________________________


More information about the New-bugs-announce mailing list