Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eccd4d9

Browse files
committed
Merged revisions 85140 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 0b441da commit eccd4d9

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

Lib/test/test_signal.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ def test_getsignal(self):
212212
@unittest.skipUnless(sys.platform == "win32", "Windows specific")
213213
class WindowsSignalTests(unittest.TestCase):
214214
def test_issue9324(self):
215+
# Updated for issue #10003, adding SIGBREAK
215216
handler = lambda x, y: None
216-
signal.signal(signal.SIGABRT, handler)
217-
signal.signal(signal.SIGFPE, handler)
218-
signal.signal(signal.SIGILL, handler)
219-
signal.signal(signal.SIGINT, handler)
220-
signal.signal(signal.SIGSEGV, handler)
221-
signal.signal(signal.SIGTERM, handler)
217+
for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE,
218+
signal.SIGILL, signal.SIGINT, signal.SIGSEGV,
219+
signal.SIGTERM):
220+
# Set and then reset a handler for signals that work on windows
221+
signal.signal(sig, signal.signal(sig, handler))
222222

223223
with self.assertRaises(ValueError):
224224
signal.signal(-1, handler)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ Library
523523
Extension Modules
524524
-----------------
525525

526+
- Issue #10003: Allow handling of SIGBREAK on Windows. Fixes a regression
527+
introduced by issue #9324.
528+
526529
- Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file
527530
descriptor is provided. Patch by Pascal Chambon.
528531

Modules/signalmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ signal_signal(PyObject *self, PyObject *args)
258258
/* Validate that sig_num is one of the allowable signals */
259259
switch (sig_num) {
260260
case SIGABRT: break;
261+
#ifdef SIGBREAK
262+
/* Issue #10003: SIGBREAK is not documented as permitted, but works
263+
and corresponds to CTRL_BREAK_EVENT. */
264+
case SIGBREAK: break;
265+
#endif
261266
case SIGFPE: break;
262267
case SIGILL: break;
263268
case SIGINT: break;

0 commit comments

Comments
 (0)