mirror of https://github.com/python/cpython
Merged revisions 86214 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86214 | antoine.pitrou | 2010-11-05 20:47:27 +0100 (ven., 05 nov. 2010) | 4 lines Issue #10311: The signal module now restores errno before returning from its low-level signal handler. Patch by Hallvard B Furuseth. ........
This commit is contained in:
parent
938ece7152
commit
8d46e4267c
|
@ -263,6 +263,7 @@ Peter Funk
|
||||||
Geoff Furnish
|
Geoff Furnish
|
||||||
Ulisses Furquim
|
Ulisses Furquim
|
||||||
Hagen Fürstenau
|
Hagen Fürstenau
|
||||||
|
Hallvard B Furuseth
|
||||||
Achim Gaedke
|
Achim Gaedke
|
||||||
Martin von Gagern
|
Martin von Gagern
|
||||||
Lele Gaifax
|
Lele Gaifax
|
||||||
|
|
|
@ -143,6 +143,9 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #10311: The signal module now restores errno before returning from
|
||||||
|
its low-level signal handler. Patch by Hallvard B Furuseth.
|
||||||
|
|
||||||
- The keyword only restriction for the places argument in
|
- The keyword only restriction for the places argument in
|
||||||
unittest.TestCase.assert[Not]AlmostEqual methods has been removed.
|
unittest.TestCase.assert[Not]AlmostEqual methods has been removed.
|
||||||
|
|
||||||
|
|
|
@ -166,16 +166,20 @@ checksignals_witharg(void * unused)
|
||||||
static void
|
static void
|
||||||
signal_handler(int sig_num)
|
signal_handler(int sig_num)
|
||||||
{
|
{
|
||||||
#ifdef WITH_THREAD
|
int save_errno = errno;
|
||||||
#ifdef WITH_PTH
|
|
||||||
|
#if defined(WITH_THREAD) && defined(WITH_PTH)
|
||||||
if (PyThread_get_thread_ident() != main_thread) {
|
if (PyThread_get_thread_ident() != main_thread) {
|
||||||
pth_raise(*(pth_t *) main_thread, sig_num);
|
pth_raise(*(pth_t *) main_thread, sig_num);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef WITH_THREAD
|
||||||
/* See NOTES section above */
|
/* See NOTES section above */
|
||||||
if (getpid() == main_pid) {
|
if (getpid() == main_pid)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
Handlers[sig_num].tripped = 1;
|
Handlers[sig_num].tripped = 1;
|
||||||
/* Set is_tripped after setting .tripped, as it gets
|
/* Set is_tripped after setting .tripped, as it gets
|
||||||
cleared in PyErr_CheckSignals() before .tripped. */
|
cleared in PyErr_CheckSignals() before .tripped. */
|
||||||
|
@ -183,19 +187,16 @@ signal_handler(int sig_num)
|
||||||
Py_AddPendingCall(checksignals_witharg, NULL);
|
Py_AddPendingCall(checksignals_witharg, NULL);
|
||||||
if (wakeup_fd != -1)
|
if (wakeup_fd != -1)
|
||||||
write(wakeup_fd, "\0", 1);
|
write(wakeup_fd, "\0", 1);
|
||||||
#ifdef WITH_THREAD
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#ifndef HAVE_SIGACTION
|
||||||
#ifdef SIGCHLD
|
#ifdef SIGCHLD
|
||||||
if (sig_num == SIGCHLD) {
|
|
||||||
/* To avoid infinite recursion, this signal remains
|
/* To avoid infinite recursion, this signal remains
|
||||||
reset until explicit re-instated.
|
reset until explicit re-instated.
|
||||||
Don't clear the 'func' field as it is our pointer
|
Don't clear the 'func' field as it is our pointer
|
||||||
to the Python handler... */
|
to the Python handler... */
|
||||||
return;
|
if (sig_num != SIGCHLD)
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_SIGACTION
|
|
||||||
/* If the handler was not set up with sigaction, reinstall it. See
|
/* If the handler was not set up with sigaction, reinstall it. See
|
||||||
* Python/pythonrun.c for the implementation of PyOS_setsig which
|
* Python/pythonrun.c for the implementation of PyOS_setsig which
|
||||||
* makes this true. See also issue8354. */
|
* makes this true. See also issue8354. */
|
||||||
|
@ -203,6 +204,11 @@ signal_handler(int sig_num)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Issue #10311: asynchronously executing signal handlers should not
|
||||||
|
mutate errno under the feet of unsuspecting C code. */
|
||||||
|
errno = save_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
Loading…
Reference in New Issue