]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Solved a potential deadlock in test_telnetlib.py. Related to issue #11812
authorJesus Cea <jcea@jcea.es>
Tue, 8 Nov 2011 14:54:42 +0000 (15:54 +0100)
committerJesus Cea <jcea@jcea.es>
Tue, 8 Nov 2011 14:54:42 +0000 (15:54 +0100)
Lib/test/test_telnetlib.py
Misc/NEWS

index e40c1fe42180f499a7eae5cef5ac52309b01a461..04cb7fea10a7da583ac4fe0d60324ba1dbec6b7a 100644 (file)
@@ -15,7 +15,6 @@ def server(evt, serv, dataq=None):
         1) set evt to true to let the parent know we are ready
         2) [optional] if is not False, write the list of data from dataq.get()
            to the socket.
-        3) set evt to true to let the parent know we're done
     """
     serv.listen(5)
     evt.set()
@@ -40,7 +39,6 @@ def server(evt, serv, dataq=None):
         conn.close()
     finally:
         serv.close()
-        evt.set()
 
 class GeneralTests(TestCase):
 
@@ -52,11 +50,8 @@ class GeneralTests(TestCase):
         self.thread = threading.Thread(target=server, args=(self.evt,self.sock))
         self.thread.start()
         self.evt.wait()
-        self.evt.clear()
-        time.sleep(.1)
 
     def tearDown(self):
-        self.evt.wait()
         self.thread.join()
 
     def testBasic(self):
@@ -105,11 +100,8 @@ def _read_setUp(self):
     self.thread = threading.Thread(target=server, args=(self.evt,self.sock, self.dataq))
     self.thread.start()
     self.evt.wait()
-    self.evt.clear()
-    time.sleep(.1)
 
 def _read_tearDown(self):
-    self.evt.wait()
     self.thread.join()
 
 class ReadTests(TestCase):
index 43e2763f6c36855d1b78c65fd128c03a3c592a92..9b1e5d11c39f64ef0553733dbc997bb26f7e2004 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -359,6 +359,8 @@ Tests
 - Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary
   failure in name resolution.
 
+- Solved a potential deadlock in test_telnetlib.py. Related to issue #11812.
+
 - Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and
   an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder
   Web site.