this is http://bugs.python.org/issue1068268

On Tue, Apr 1, 2008 at 5:05 PM, <skip@pobox.com> wrote:
test_signal is failing on osx g4:

   test test_signal failed -- Traceback (most recent call last):
     File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_signal.py", line 151, in test_main
       self.fail(tb)
   AssertionError: Traceback (most recent call last):
     File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_signal.py", line 134, in test_main
       self.run_test()
     File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_signal.py", line 80, in run_test
       child = subprocess.Popen(['kill', '-HUP', str(pid)])
     File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/subprocess.py", line 593, in __init__
       errread, errwrite)
     File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/subprocess.py", line 1078, in _execute_child
       data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
   OSError: [Errno 4] Interrupted system call

This is the code which reads stderr from the child process:

   data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
   os.close(errpipe_read)
   if data != "":
       os.waitpid(self.pid, 0)
       child_exception = pickle.loads(data)
       raise child_exception

I'm not an expert in this stuff my any stretch of the imagination, but
shouldn't subprocess try harder to read this output?  Something like:

   while True:
       try:
           data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
       except OSError, err:
           if err.errno == errno.EINTR:
               continue
           else:
               raise
       else:
           os.close(errpipe_read)
           if data != "":
               os.waitpid(self.pid, 0)
               child_exception = pickle.loads(data)
               raise child_exception
           break

Maybe not while True, but try a few times at least. 

Or is the system supposed to automatically restart interrupted system calls? 

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/schmir%40gmail.com