This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ddvento@ucar.edu
Recipients ddvento@ucar.edu, erob, pitrou
Date 2013-06-05.18:07:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <51AF7E5B.5080403@ucar.edu>
In-reply-to <51AF76F3.3040708@ucar.edu>
Content
Note that the previous patch would still let the test suite crash if the 
sendall() takes a short enough time.

Having the test suite crash is so bad that I believe this should be the 
first issue to be fixed!

The following patch prevents the test suite from crashing (however, 
without the previous patch, it lets this particular test fail on my 
machine).

--- Python-2.7.5/Lib/test/test_socket.py    2013-05-11 
21:32:47.000000000 -0600
+++ Python-2.7.5-socket-fix/Lib/test/test_socket.py    2013-06-05 
12:05:41.038089911 -0600
@@ -691,6 +691,15 @@
                  signal.alarm(1)
                  self.assertRaises(socket.timeout, c.sendall, b"x" * 
(1024**2))
          finally:
+            # If c.sendall finishes before this process receives 
SIGALRM and
+            # the original signal handler is restored, the process will 
receive
+            # it and execute its default behavior of killing the
+            # interpreter. Make sure this doesn't happen by sleeping before
+            # restoring the original signal handler. Since only one alarm
+            # handler can be registered at once, we only need to sleep 
for 1
+            # second since both have been called with the same 1 second 
time
+            # argument.
+            time.sleep(1)
              signal.signal(signal.SIGALRM, old_alarm)
              c.close()
              s.close()

Regards,
Davide Del Vento,
NCAR Computational & Information Services Laboratory
Consulting Services Software Engineer
http://www2.cisl.ucar.edu/uss/csg/
SEA Chair http://sea.ucar.edu/
office: Mesa Lab, Room 55G
History
Date User Action Args
2013-06-05 18:07:17ddvento@ucar.edusetrecipients: + ddvento@ucar.edu, pitrou, erob
2013-06-05 18:07:17ddvento@ucar.edulinkissue17085 messages
2013-06-05 18:07:16ddvento@ucar.educreate