mirror of https://github.com/python/cpython
SF patch [#466877] SIGBREAK is missing from signal module.
Patch from Steve Scott to add SIGBREAK support (unique to Windows).
This commit is contained in:
parent
fbacaf7298
commit
1ce3cf7749
|
@ -362,6 +362,7 @@ Peter Schneider-Kamp
|
||||||
Sam Schulenburg
|
Sam Schulenburg
|
||||||
Dietmar Schwertberger
|
Dietmar Schwertberger
|
||||||
Barry Scott
|
Barry Scott
|
||||||
|
Steven Scott
|
||||||
Nick Seidenman
|
Nick Seidenman
|
||||||
Fred Sells
|
Fred Sells
|
||||||
Denis Severson
|
Denis Severson
|
||||||
|
|
20
Misc/NEWS
20
Misc/NEWS
|
@ -31,6 +31,26 @@ Tests
|
||||||
|
|
||||||
Windows
|
Windows
|
||||||
|
|
||||||
|
- The signal module now supports SIGBREAK on Windows, thanks to Steven
|
||||||
|
Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
|
||||||
|
action remains to call Win32 ExitProcess(). This can be changed via
|
||||||
|
signal.signal(). For example:
|
||||||
|
|
||||||
|
# Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
|
||||||
|
# (SIGINT) behavior.
|
||||||
|
import signal
|
||||||
|
signal.signal(signal.SIGBREAK,
|
||||||
|
signal.default_int_handler)
|
||||||
|
|
||||||
|
try:
|
||||||
|
while 1:
|
||||||
|
pass
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
# We get here on Ctrl+C or Ctrl+Break now; if we had not changed
|
||||||
|
# SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
|
||||||
|
# program without the possibility for any Python-level cleanup).
|
||||||
|
print "Clean exit"
|
||||||
|
|
||||||
|
|
||||||
What's New in Python 2.2a4?
|
What's New in Python 2.2a4?
|
||||||
Release date: 28-Sep-2001
|
Release date: 28-Sep-2001
|
||||||
|
|
|
@ -383,6 +383,11 @@ initsignal(void)
|
||||||
PyDict_SetItemString(d, "SIGINT", x);
|
PyDict_SetItemString(d, "SIGINT", x);
|
||||||
Py_XDECREF(x);
|
Py_XDECREF(x);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SIGBREAK
|
||||||
|
x = PyInt_FromLong(SIGBREAK);
|
||||||
|
PyDict_SetItemString(d, "SIGBREAK", x);
|
||||||
|
Py_XDECREF(x);
|
||||||
|
#endif
|
||||||
#ifdef SIGQUIT
|
#ifdef SIGQUIT
|
||||||
x = PyInt_FromLong(SIGQUIT);
|
x = PyInt_FromLong(SIGQUIT);
|
||||||
PyDict_SetItemString(d, "SIGQUIT", x);
|
PyDict_SetItemString(d, "SIGQUIT", x);
|
||||||
|
|
Loading…
Reference in New Issue