[Python-Dev] test_signal on osx g4 (original) (raw)

skip at pobox.com skip at pobox.com
Tue Apr 1 17:05:28 CEST 2008


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



More information about the Python-Dev mailing list