ddve...@ucar.edu added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to