diff options
author | Hill Ma <mahiuchun@users.noreply.github.com> | 2019-12-05 12:40:12 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-12-05 12:40:12 (GMT) |
commit | 99eb70a9eb9493602ff6ad8bb92df4318cf05a3e (patch) | |
tree | eccbf5c0c0ce2c69a4eac2dab15ab99a5676e393 /Lib/asyncio/unix_events.py | |
parent | bb815499af855b1759c02535f8d7a9d0358e74e8 (diff) | |
download | cpython-99eb70a9eb9493602ff6ad8bb92df4318cf05a3e.zip cpython-99eb70a9eb9493602ff6ad8bb92df4318cf05a3e.tar.gz cpython-99eb70a9eb9493602ff6ad8bb92df4318cf05a3e.tar.bz2 |
bpo-38951: Use threading.main_thread() check in asyncio (GH-17433)
https://bugs.python.org/issue38951
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 632546a..97198ea 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -1406,8 +1406,7 @@ class _UnixDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy): with events._lock: if self._watcher is None: # pragma: no branch self._watcher = ThreadedChildWatcher() - if isinstance(threading.current_thread(), - threading._MainThread): + if threading.current_thread() is threading.main_thread(): self._watcher.attach_loop(self._local._loop) def set_event_loop(self, loop): @@ -1421,7 +1420,7 @@ class _UnixDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy): super().set_event_loop(loop) if (self._watcher is not None and - isinstance(threading.current_thread(), threading._MainThread)): + threading.current_thread() is threading.main_thread()): self._watcher.attach_loop(loop) def get_child_watcher(self): |