[Python-checkins] bpo-31234: Fix dangling thread in test_ftplib (#3544)

Victor Stinner webhook-mailer at python.org
Wed Sep 13 09:44:01 EDT 2017


https://github.com/python/cpython/commit/b157ce1e58b03988ce4340a55d0b856125833cc5
commit: b157ce1e58b03988ce4340a55d0b856125833cc5
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-09-13T06:43:58-07:00
summary:

bpo-31234: Fix dangling thread in test_ftplib (#3544)

Clear also self.server_thread attribute in TestTimeouts.tearDown().

files:
M Lib/test/test_ftplib.py

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 @@ def setUp(self):
     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:



More information about the Python-checkins mailing list