diff options
Diffstat (limited to 'Lib/asyncio/events.py')
-rw-r--r-- | Lib/asyncio/events.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 6af9137..03af699 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -606,8 +606,7 @@ _lock = threading.Lock() # A TLS for the running event loop, used by _get_running_loop. class _RunningLoop(threading.local): - _loop = None - _pid = None + loop_pid = (None, None) _running_loop = _RunningLoop() @@ -619,8 +618,8 @@ def _get_running_loop(): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - running_loop = _running_loop._loop - if running_loop is not None and _running_loop._pid == os.getpid(): + running_loop, pid = _running_loop.loop_pid + if running_loop is not None and pid == os.getpid(): return running_loop @@ -630,8 +629,7 @@ def _set_running_loop(loop): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - _running_loop._pid = os.getpid() - _running_loop._loop = loop + _running_loop.loop_pid = (loop, os.getpid()) def _init_event_loop_policy(): |