File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
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