]> granicus.if.org Git - python/commitdiff
Fix #10003. Add SIGBREAK to the set of valid signals on Windows.
authorBrian Curtin <brian.curtin@gmail.com>
Fri, 1 Oct 2010 14:49:24 +0000 (14:49 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Fri, 1 Oct 2010 14:49:24 +0000 (14:49 +0000)
This fixes a regression noticed by bzr, introduced by issue #9324.

Lib/test/test_signal.py
Misc/NEWS
Modules/signalmodule.c

index 7aa03ef8920561bc33b73365a904f3cadda0d266..1f15ff76fe81e8fa7a2286de82448d3d18d4ad59 100644 (file)
@@ -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)
index a0d827518daee9239dff51ab7d5229b8914c034a..8e99376af47fbb17ddb5d066b61e1c472006d519 100644 (file)
--- 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
index 8b60e41e80793b06d6467a0622f22a25cc5591cf..d34e177ec917826290f260eebde0722c2ce75f06 100644 (file)
@@ -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;