[issue8354] siginterrupt with flag=False is reset when signal received

Charles-Francois Natali report at bugs.python.org
Fri Apr 9 21:56:19 CEST 2010


Charles-Francois Natali <neologix at free.fr> added the comment:

Attached are two patches:
- test_signal_siginterrupt.diff is a patch for Lib/test/test_signal.py to check for this problem (more than one signal received after calling signal.siginterrupt())
before:
$ ./python Lib/test/regrtest.py test_signal
test_signal
1 test OK.

after:
$ ./python Lib/test/regrtest.py test_signal
test_signal
test test_signal failed -- Traceback (most recent call last):
  File "/home/cf/python/trunk/Lib/test/test_signal.py", line 299, in test_siginterrupt_off
    self.assertEquals(i, False)
AssertionError: True != False

1 test failed:
    test_signal

- signal_noreinstall.diff is a patch against Modules/signalmodule.c which modifies signal_handler() to call PyOS_setsig() only when sigaction is not available, since in that case the signal handler doesn't need to be reinstalled. This solves this problem, and also saves a call to sigaction every time a signal is received (even if its probably doesn't cost much).

with patch and updated test:
$ ./python Lib/test/regrtest.py test_signal
test_signal
1 test OK.

Of course, this also corrects the problem with sig-test.py, the terminal can be resized indefinitely.
I also passed test_subprocess and test_socketserver just to be sure, but reviews are more than welcome.

----------
keywords: +patch
Added file: http://bugs.python.org/file16847/test_signal_siginterrupt.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8354>
_______________________________________


More information about the Python-bugs-list mailing list