summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poplib.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-13 10:58:25 (GMT)
committerGitHub <noreply@github.com>2017-09-13 10:58:25 (GMT)
commitd403a29c0055de6b03ed5ae7a5c564e1c95a5950 (patch)
tree5f2472b332617c94b439230f31d8101549eaa356 /Lib/test/test_poplib.py
parentb8f4163da30e16c7cd58fe04f4b17e38d53cd57e (diff)
downloadcpython-d403a29c0055de6b03ed5ae7a5c564e1c95a5950.zip
cpython-d403a29c0055de6b03ed5ae7a5c564e1c95a5950.tar.gz
cpython-d403a29c0055de6b03ed5ae7a5c564e1c95a5950.tar.bz2
bpo-31234: Fix dangling thread in test_ftp/poplib (#3540)
Explicitly clear the server attribute in test_ftplib and test_poplib to prevent dangling thread.
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r--Lib/test/test_poplib.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index 92febbf..d7a26bc 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -254,6 +254,8 @@ class TestPOP3Class(TestCase):
def tearDown(self):
self.client.close()
self.server.stop()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server = None
def test_getwelcome(self):
self.assertEqual(self.client.getwelcome(),
@@ -436,6 +438,8 @@ class TestPOP3_TLSClass(TestPOP3Class):
# this exception
self.client.close()
self.server.stop()
+ # Explicitly clear the attribute to prevent dangling thread
+ self.server = None
def test_stls(self):
self.assertRaises(poplib.error_proto, self.client.stls)
@@ -461,7 +465,8 @@ class TestTimeouts(TestCase):
def tearDown(self):
self.thread.join()
- del self.thread # Clear out any dangling Thread objects.
+ # Explicitly clear the attribute to prevent dangling thread
+ self.thread = None
def server(self, evt, serv):
serv.listen()