[Python-checkins] cpython (2.7): Solved a potential deadlock in test_telnetlib.py. Related to issue #11812

jesus.cea python-checkins at python.org
Tue Nov 8 16:39:34 CET 2011


http://hg.python.org/cpython/rev/76b6b85e4b78
changeset:   73449:76b6b85e4b78
branch:      2.7
parent:      73418:60dd1568bbd1
user:        Jesus Cea <jcea at jcea.es>
date:        Tue Nov 08 15:54:42 2011 +0100
summary:
  Solved a potential deadlock in test_telnetlib.py. Related to issue #11812

files:
  Lib/test/test_telnetlib.py |  8 --------
  Misc/NEWS                  |  2 ++
  2 files changed, 2 insertions(+), 8 deletions(-)


diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -15,7 +15,6 @@
         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 @@
         conn.close()
     finally:
         serv.close()
-        evt.set()
 
 class GeneralTests(TestCase):
 
@@ -52,11 +50,8 @@
         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 @@
     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):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -359,6 +359,8 @@
 - 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.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list