File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -892,7 +892,7 @@ a worker thread and the actual call than made at the earliest convenience by the
892892main thread where it has possession of the global interpreter lock and can
893893perform any Python API calls.
894894
895- .. cfunction :: void Py_AddPendingCall( int (*func)(void *, void *arg) )
895+ .. cfunction :: void Py_AddPendingCall(int (*func)(void *) , void *arg)
896896
897897 .. index :: single: Py_AddPendingCall()
898898
Original file line number Diff line number Diff line change 1111from test import support
1212import os
1313from os import path
14+ from time import sleep
1415
1516startfile = support .get_attribute (os , 'startfile' )
1617
@@ -23,6 +24,10 @@ def test_empty(self):
2324 empty = path .join (path .dirname (__file__ ), "empty.vbs" )
2425 startfile (empty )
2526 startfile (empty , "open" )
27+ # Give the child process some time to exit before we finish.
28+ # Otherwise the cleanup code will not be able to delete the cwd,
29+ # because it is still in use.
30+ sleep (0.1 )
2631
2732def test_main ():
2833 support .run_unittest (TestCase )
Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ Core and Builtins
5555Library
5656-------
5757
58+ - Issue #11768: The signal handler of the signal module only calls
59+ Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or
60+ parallel calls. PyErr_SetInterrupt() writes also into the wake up file.
61+
5862- Issue #11467: Fix urlparse behavior when handling urls which contains scheme
5963 specific part only digits. Patch by Santoso Wijaya.
6064
@@ -314,6 +318,8 @@ Build
314318Tests
315319-----
316320
321+ - Fix test_startfile to wait for child process to terminate before finishing.
322+
317323- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
318324 platforms. Patch by Nadeem Vawda.
319325
Original file line number Diff line number Diff line change @@ -163,6 +163,20 @@ checksignals_witharg(void * unused)
163163 return PyErr_CheckSignals ();
164164}
165165
166+ static void
167+ trip_signal (int sig_num )
168+ {
169+ Handlers [sig_num ].tripped = 1 ;
170+ if (is_tripped )
171+ return ;
172+ /* Set is_tripped after setting .tripped, as it gets
173+ cleared in PyErr_CheckSignals() before .tripped. */
174+ is_tripped = 1 ;
175+ Py_AddPendingCall (checksignals_witharg , NULL );
176+ if (wakeup_fd != -1 )
177+ write (wakeup_fd , "\0" , 1 );
178+ }
179+
166180static void
167181signal_handler (int sig_num )
168182{
@@ -180,13 +194,7 @@ signal_handler(int sig_num)
180194 if (getpid () == main_pid )
181195#endif
182196 {
183- Handlers [sig_num ].tripped = 1 ;
184- /* Set is_tripped after setting .tripped, as it gets
185- cleared in PyErr_CheckSignals() before .tripped. */
186- is_tripped = 1 ;
187- Py_AddPendingCall (checksignals_witharg , NULL );
188- if (wakeup_fd != -1 )
189- write (wakeup_fd , "\0" , 1 );
197+ trip_signal (sig_num );
190198 }
191199
192200#ifndef HAVE_SIGACTION
@@ -932,9 +940,7 @@ PyErr_CheckSignals(void)
932940void
933941PyErr_SetInterrupt (void )
934942{
935- is_tripped = 1 ;
936- Handlers [SIGINT ].tripped = 1 ;
937- Py_AddPendingCall ((int (* )(void * ))PyErr_CheckSignals , NULL );
943+ trip_signal (SIGINT );
938944}
939945
940946void
You can’t perform that action at this time.
0 commit comments