[Python-checkins] r85141 - in python/branches/release31-maint: Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c

brian.curtin python-checkins at python.org
Fri Oct 1 17:09:53 CEST 2010


Author: brian.curtin
Date: Fri Oct  1 17:09:53 2010
New Revision: 85141

Log:
Merged revisions 85140 via svnmerge from 
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.
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/test/test_signal.py
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Modules/signalmodule.c

Modified: python/branches/release31-maint/Lib/test/test_signal.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_signal.py	(original)
+++ python/branches/release31-maint/Lib/test/test_signal.py	Fri Oct  1 17:09:53 2010
@@ -212,13 +212,13 @@
 @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)

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Fri Oct  1 17:09:53 2010
@@ -523,6 +523,9 @@
 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.
 

Modified: python/branches/release31-maint/Modules/signalmodule.c
==============================================================================
--- python/branches/release31-maint/Modules/signalmodule.c	(original)
+++ python/branches/release31-maint/Modules/signalmodule.c	Fri Oct  1 17:09:53 2010
@@ -258,6 +258,11 @@
     /* 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;


More information about the Python-checkins mailing list