From b157ce1e58b03988ce4340a55d0b856125833cc5 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 13 Sep 2017 06:43:58 -0700 Subject: [PATCH] bpo-31234: Fix dangling thread in test_ftplib (#3544) Clear also self.server_thread attribute in TestTimeouts.tearDown(). --- Lib/test/test_ftplib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 372282b4faf..5880a1e941d 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -988,6 +988,8 @@ class TestTimeouts(TestCase): def tearDown(self): ftplib.FTP.port = self.old_port self.server_thread.join() + # Explicitly clear the attribute to prevent dangling thread + self.server_thread = None def server(self): # This method sets the evt 3 times: