Kaydet (Commit) 2ef08d3b authored tarafından Yury Selivanov's avatar Yury Selivanov

asyncio: Optimize _get_running_loop() to call getpid() only when there's a loop

üst 604faba1
......@@ -624,8 +624,9 @@ def _get_running_loop():
This is a low-level function intended to be used by event loops.
This function is thread-specific.
"""
if _running_loop._pid == os.getpid():
return _running_loop._loop
running_loop = _running_loop._loop
if running_loop is not None and _running_loop._pid == os.getpid():
return running_loop
def _set_running_loop(loop):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment