]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 85140 via svnmerge from
authorBrian Curtin <brian.curtin@gmail.com>
Fri, 1 Oct 2010 16:44:03 +0000 (16:44 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Fri, 1 Oct 2010 16:44:03 +0000 (16:44 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85140 | brian.curtin | 2010-10-01 09:49:24 -0500 (Fri, 01 Oct 2010) | 4 lines

  Fix #10003. Add SIGBREAK to the set of valid signals on Windows.

  This fixes a regression noticed by bzr, introduced by issue #9324.
........

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

index 906b4a09a04ab72bbe0521d6c38a6e333126e0a6..d35d7c46c9cd6a690540ac350c678da781b901b1 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 78eb34f920dcd5f396b22eb04d23067a9553f467..1fabf61501b2c5d458b3bcc4311bec10ab68e29e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -299,6 +299,9 @@ Library
 Extension Modules
 -----------------
 
+- Issue #10003: Allow handling of SIGBREAK on Windows. Fixes a regression
+  introduced by issue #9324. 
+
 - Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file
   descriptor is provided.  Patch by Pascal Chambon.
 
index 5aeee4c06defcabf1d38d6eb687aeb67d8c9cb2d..b49e13c9368e404bf07fa0964a57ff4df55fc7e1 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;