diff options
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/events.py | 2 | ||||
-rw-r--r-- | Lib/asyncio/unix_events.py | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 36b7ea307e..c7343f515c 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -636,7 +636,7 @@ class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy): """ if (self._local._loop is None and not self._local._set_called and - isinstance(threading.current_thread(), threading._MainThread)): + threading.current_thread() is threading.main_thread()): self.set_event_loop(self.new_event_loop()) if self._local._loop is None: diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 632546ad00..97198ea2f4 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): |