8000 Back to basics · python/cpython@fd13f23 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd13f23

Browse files
committed
Back to basics
1 parent bda45c8 commit fd13f23

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

Lib/asyncio/unix_events.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,14 +1371,7 @@ def is_active(self):
13711371
return True
13721372

13731373
def close(self):
1374-
self._join_threads()
1375-
1376-
def _join_threads(self, timeout=None):
1377-
"""Internal: Join all non-daemon threads"""
1378-
threads = [thread for thread in list(self._threads.values())
1379-
if thread.is_alive() and not thread.daemon]
1380-
for thread in threads:
1381-
thread.join(timeout)
1374+
pass
13821375

13831376
# Clear references to terminated threads
13841377
self._threads = {key: thread for key, thread in self._threads.items()

Lib/test/test_asyncio/utils.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ def get_function_source(func):
538538

539539

540540
class TestCase(unittest.TestCase):
541-
def close_loop(self, loop):
541+
@staticmethod
542+
def close_loop(loop):
542543
if loop._default_executor is not None:
543544
if not loop.is_closed():
544545
loop.run_until_complete(loop.shutdown_default_executor())
@@ -557,12 +558,8 @@ def close_loop(self, loop):
557558
pass
558559
else:
559560
if isinstance(watcher, asyncio.ThreadedChildWatcher):
560-
watcher._join_threads(timeout=support.SHORT_TIMEOUT)
561-
threads = {key: thread for key, thread in watcher._threads.items()
562-
if thread.is_alive() and not thread.daemon}
563-
if threads:
564-
self.fail(f"watcher still has running threads: "
565-
f"{threads}")
561+
for thread in list(watcher._threads.values()):
562+
thread.join(timeout=support.SHORT_TIMEOUT)
566563

567564
def set_event_loop(self, loop, *, cleanup=True):
568565
if loop is None:

0 commit comments

Comments
 (0)
0