diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2013-08-03 12:56:30 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2013-08-03 12:56:30 (GMT) |
commit | 60b3ac7482aa7ca4e6f0f66792160d38b48d1914 (patch) | |
tree | 6aa391af41470e295c41f9fd224e5661b2fd3c68 /Lib/test | |
parent | e92dfbfec8db930c5960492c3d9470f3415e27a3 (diff) | |
download | cpython-60b3ac7482aa7ca4e6f0f66792160d38b48d1914.zip cpython-60b3ac7482aa7ca4e6f0f66792160d38b48d1914.tar.gz cpython-60b3ac7482aa7ca4e6f0f66792160d38b48d1914.tar.bz2 |
Close #18396: fix spurious test_signal failure on Windows
signal.getsignal returns None for some signals if faulthandler
is enabled (Patch by Jeremy Kloth)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_signal.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 1ef7643..9b4ba50 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -209,11 +209,17 @@ class WindowsSignalTests(unittest.TestCase): def test_issue9324(self): # Updated for issue #10003, adding SIGBREAK handler = lambda x, y: None + checked = set() for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM): - # Set and then reset a handler for signals that work on windows - signal.signal(sig, signal.signal(sig, handler)) + # Set and then reset a handler for signals that work on windows. + # Issue #18396, only for signals without a C-level handler. + if signal.getsignal(sig) is not None: + signal.signal(sig, signal.signal(sig, handler)) + checked.add(sig) + # Issue #18396: Ensure the above loop at least tested *something* + self.assertTrue(checked) with self.assertRaises(ValueError): signal.signal(-1, handler) |