From 0b2489e986dd8fa3c58c242dd30559fce5135aaa Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 15 May 2011 08:49:12 +0200 Subject: [PATCH 1/2] Closes #6498: fix several misspellings of "SystemExit" as "SystemError". --- Doc/c-api/veryhigh.rst | 11 ++++++----- Python/pythonrun.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst index 66789a963da..d1940a8d9db 100644 --- a/Doc/c-api/veryhigh.rst +++ b/Doc/c-api/veryhigh.rst @@ -34,11 +34,12 @@ the same library that the Python runtime is using. according to the user's locale). It is important to note that the argument list may be modified (but the contents of the strings pointed to by the argument list are not). The return value will be - the integer passed to the :func:`sys.exit` function, ``1`` if the - interpreter exits due to an exception, or ``2`` if the parameter - list does not represent a valid Python command line. + ```0``` if the interpreter exits normally (ie, without an + exception), ``1`` if the interpreter exits due to an exception, or + ``2`` if the parameter list does not represent a valid Python + command line. - Note that if an otherwise unhandled :exc:`SystemError` is raised, this + Note that if an otherwise unhandled :exc:`SystemExit` is raised, this function will not return ``1``, but exit the process, as long as ``Py_InspectFlag`` is not set. @@ -84,7 +85,7 @@ the same library that the Python runtime is using. there was an error, there is no way to get the exception information. For the meaning of *flags*, see below. - Note that if an otherwise unhandled :exc:`SystemError` is raised, this + Note that if an otherwise unhandled :exc:`SystemExit` is raised, this function will not return ``-1``, but exit the process, as long as ``Py_InspectFlag`` is not set. diff --git a/Python/pythonrun.c b/Python/pythonrun.c index c6cf0882325..c4ae9211ffa 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -82,7 +82,7 @@ extern void _PyGILState_Fini(void); int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ -int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */ +int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */ int Py_NoSiteFlag; /* Suppress 'import site' */ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */ int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */ From 2ec6b176bd0fc41c6d00f244a4d8d6bdefa2c620 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 15 May 2011 10:21:59 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Issue=20#12060:=20Use=20sig=5Fatomic=5Ft=20?= =?UTF-8?q?type=20and=20volatile=20keyword=20in=20the=20signal=20module.?= =?UTF-8?q?=20Patch=20written=20by=20Charles-Fran=C3=A7ois=20Natali.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS | 3 +++ Modules/signalmodule.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 8618363e2dd..c41e475cc94 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.1.4? Core and Builtins ----------------- +- Issue #12060: Use sig_atomic_t type and volatile keyword in the signal + module. Patch written by Charles-François Natali. + - Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c, clear the end-of-file indicator after CTRL+d. diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 14297709c51..5a6c777fb54 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -78,12 +78,12 @@ static long main_thread; static pid_t main_pid; #endif -static struct { - int tripped; +static volatile struct { + sig_atomic_t tripped; PyObject *func; } Handlers[NSIG]; -static sig_atomic_t wakeup_fd = -1; +static volatile sig_atomic_t wakeup_fd = -1; /* Speed up sigcheck() when none tripped */ static volatile sig_atomic_t is_tripped = 0;