Skip to content

Commit 11470b6

Browse files
authored
bpo-30106: Fix tearDown() of test_asyncore (#1194)
Call asyncore.close_all() with ignore_all=True in the tearDown() method of the test_asyncore base test case. It should prevent keeping alive sockets in asyncore.socket_map if close() fails with an unexpected error. Revert also an unwanted change of my previous commit: remove name parameter of Thread in test_quick_connect().
1 parent d13d547 commit 11470b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_asyncore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def handle_connect(self):
502502
class BaseTestAPI:
503503

504504
def tearDown(self):
505-
asyncore.close_all()
505+
asyncore.close_all(ignore_all=True)
506506

507507
def loop_waiting_for_flag(self, instance, timeout=5):
508508
timeout = float(timeout) / 100
@@ -782,7 +782,7 @@ def test_quick_connect(self):
782782

783783
server = BaseServer(self.family, self.addr)
784784
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1,
785-
count=500), name="ident")
785+
count=500))
786786
t.start()
787787
try:
788788
with socket.socket(self.family, socket.SOCK_STREAM) as s:

0 commit comments

Comments
 (0)