summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-10-01 14:49:24 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-10-01 14:49:24 (GMT)
commit9e88b5aeee219c8b1968a29f206231cca2719ed3 (patch)
tree1adbbeb1e4e9273bc5c53e8e9ba8d3571841b037
parent38e299615270e2a4a9b223b789924e899847f3cc (diff)
downloadcpython-9e88b5aeee219c8b1968a29f206231cca2719ed3.zip
cpython-9e88b5aeee219c8b1968a29f206231cca2719ed3.tar.gz
cpython-9e88b5aeee219c8b1968a29f206231cca2719ed3.tar.bz2
Fix #10003. Add SIGBREAK to the set of valid signals on Windows.
This fixes a regression noticed by bzr, introduced by issue #9324.
-rw-r--r--Lib/test/test_signal.py12
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/signalmodule.c5
3 files changed, 14 insertions, 6 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 7aa03ef..1f15ff7 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -212,13 +212,13 @@ class BasicSignalTests(unittest.TestCase):
@unittest.skipUnless(sys.platform == "win32", "Windows specific")
class WindowsSignalTests(unittest.TestCase):
def test_issue9324(self):
+ # Updated for issue #10003, adding SIGBREAK
handler = lambda x, y: None
- signal.signal(signal.SIGABRT, handler)
- signal.signal(signal.SIGFPE, handler)
- signal.signal(signal.SIGILL, handler)
- signal.signal(signal.SIGINT, handler)
- signal.signal(signal.SIGSEGV, handler)
- signal.signal(signal.SIGTERM, handler)
+ 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))
with self.assertRaises(ValueError):
signal.signal(-1, handler)
diff --git a/Misc/NEWS b/Misc/NEWS
index a0d8275..8e99376 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.2 Alpha 3?
Core and Builtins
-----------------
+- Issue #10003: Allow handling of SIGBREAK on Windows. Fixes a regression
+ introduced by issue #9324.
+
- Issue #9979: Create function PyUnicode_AsWideCharString().
- Issue #7397: Mention that importlib.import_module() is probably what someone
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 8b60e41..d34e177 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -261,6 +261,11 @@ signal_signal(PyObject *self, PyObject *args)
/* Validate that sig_num is one of the allowable signals */
switch (sig_num) {
case SIGABRT: break;
+#ifdef SIGBREAK
+ /* Issue #10003: SIGBREAK is not documented as permitted, but works
+ and corresponds to CTRL_BREAK_EVENT. */
+ case SIGBREAK: break;
+#endif
case SIGFPE: break;
case SIGILL: break;
case SIGINT: break;