[issue39529] Deprecate get_event_loop()

Andrew Svetlov report at bugs.python.org
Sun Feb 2 11:49:58 EST 2020


Andrew Svetlov <andrew.svetlov at gmail.com> added the comment:

Serhiy, maybe I had not understood your proposal properly.

If you are asking about deprecating get_event_loop() call from outside of async code but implicit call get_running_loop() without a warning if called from async function -- it sounds like a brilliant idea.

Something like:

def get_event_loop():
    current_loop = _get_running_loop()
    if current_loop is not None:
        return current_loop
    warnings.warn("...", DeprecationWarning)  
    return get_event_loop_policy().get_event_loop()

----------

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


More information about the Python-bugs-list mailing list