cpython: fdcbc8453304 (original) (raw)

Mercurial > cpython

changeset 69425:fdcbc8453304

(Merge 3.2) Issue #11768: The signal handler of the signal module only calls Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or parallel calls. PyErr_SetInterrupt() writes also into the wake up file. [#11768]

Victor Stinner victor.stinner@haypocalc.com
date Mon, 18 Apr 2011 16:30:17 +0200
parents fcd20a565b95(current diff)28ab8c6ad8f9(diff)
children 2f3fda9d3906
files Lib/test/test_threadsignals.py Misc/NEWS
diffstat 3 files changed, 20 insertions(+), 18 deletions(-)[+] [-] Lib/test/test_threadsignals.py 8 Misc/NEWS 4 Modules/signalmodule.c 26

line wrap: on

line diff

--- a/Lib/test/test_threadsignals.py +++ b/Lib/test/test_threadsignals.py @@ -30,14 +30,9 @@ def handle_signals(sig,frame):

a function that will be spawned as a separate thread.

def send_signals():

class ThreadSignals(unittest.TestCase): @@ -46,12 +41,9 @@ class ThreadSignals(unittest.TestCase): # We spawn a thread, have the thread send two signals, and # wait for it to finish. Check that we got both signals # and that they were run by the main thread.

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -110,6 +110,10 @@ Core and Builtins Library ------- +- Issue #11768: The signal handler of the signal module only calls

--- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -166,6 +166,20 @@ checksignals_witharg(void * unused) } static void +trip_signal(int sig_num) +{

+} + +static void signal_handler(int sig_num) { int save_errno = errno; @@ -182,13 +196,7 @@ signal_handler(int sig_num) if (getpid() == main_pid) #endif {

#ifndef HAVE_SIGACTION @@ -946,9 +954,7 @@ PyErr_CheckSignals(void) void PyErr_SetInterrupt(void) {

} void