Commit 11147445 authored by Raymond Hettinger's avatar Raymond Hettinger

merge

parents ab694380 58de6ee8
...@@ -892,7 +892,7 @@ a worker thread and the actual call than made at the earliest convenience by the ...@@ -892,7 +892,7 @@ a worker thread and the actual call than made at the earliest convenience by the
main thread where it has possession of the global interpreter lock and can main thread where it has possession of the global interpreter lock and can
perform any Python API calls. perform any Python API calls.
.. cfunction:: void Py_AddPendingCall( int (*func)(void *, void *arg) ) .. cfunction:: void Py_AddPendingCall(int (*func)(void *), void *arg)
.. index:: single: Py_AddPendingCall() .. index:: single: Py_AddPendingCall()
......
...@@ -11,6 +11,7 @@ import unittest ...@@ -11,6 +11,7 @@ import unittest
from test import support from test import support
import os import os
from os import path from os import path
from time import sleep
startfile = support.get_attribute(os, 'startfile') startfile = support.get_attribute(os, 'startfile')
...@@ -23,6 +24,10 @@ class TestCase(unittest.TestCase): ...@@ -23,6 +24,10 @@ class TestCase(unittest.TestCase):
empty = path.join(path.dirname(__file__), "empty.vbs") empty = path.join(path.dirname(__file__), "empty.vbs")
startfile(empty) startfile(empty)
startfile(empty, "open") startfile(empty, "open")
# Give the child process some time to exit before we finish.
# Otherwise the cleanup code will not be able to delete the cwd,
# because it is still in use.
sleep(0.1)
def test_main(): def test_main():
support.run_unittest(TestCase) support.run_unittest(TestCase)
......
...@@ -55,6 +55,10 @@ Core and Builtins ...@@ -55,6 +55,10 @@ Core and Builtins
Library Library
------- -------
- 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.
- Issue #11467: Fix urlparse behavior when handling urls which contains scheme - Issue #11467: Fix urlparse behavior when handling urls which contains scheme
specific part only digits. Patch by Santoso Wijaya. specific part only digits. Patch by Santoso Wijaya.
...@@ -314,6 +318,8 @@ Build ...@@ -314,6 +318,8 @@ Build
Tests Tests
----- -----
- Fix test_startfile to wait for child process to terminate before finishing.
- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows - Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
platforms. Patch by Nadeem Vawda. platforms. Patch by Nadeem Vawda.
......
...@@ -163,6 +163,20 @@ checksignals_witharg(void * unused) ...@@ -163,6 +163,20 @@ checksignals_witharg(void * unused)
return PyErr_CheckSignals(); return PyErr_CheckSignals();
} }
static void
trip_signal(int sig_num)
{
Handlers[sig_num].tripped = 1;
if (is_tripped)
return;
/* Set is_tripped after setting .tripped, as it gets
cleared in PyErr_CheckSignals() before .tripped. */
is_tripped = 1;
Py_AddPendingCall(checksignals_witharg, NULL);
if (wakeup_fd != -1)
write(wakeup_fd, "\0", 1);
}
static void static void
signal_handler(int sig_num) signal_handler(int sig_num)
{ {
...@@ -180,13 +194,7 @@ signal_handler(int sig_num) ...@@ -180,13 +194,7 @@ signal_handler(int sig_num)
if (getpid() == main_pid) if (getpid() == main_pid)
#endif #endif
{ {
Handlers[sig_num].tripped = 1; trip_signal(sig_num);
/* Set is_tripped after setting .tripped, as it gets
cleared in PyErr_CheckSignals() before .tripped. */
is_tripped = 1;
Py_AddPendingCall(checksignals_witharg, NULL);
if (wakeup_fd != -1)
write(wakeup_fd, "\0", 1);
} }
#ifndef HAVE_SIGACTION #ifndef HAVE_SIGACTION
...@@ -932,9 +940,7 @@ PyErr_CheckSignals(void) ...@@ -932,9 +940,7 @@ PyErr_CheckSignals(void)
void void
PyErr_SetInterrupt(void) PyErr_SetInterrupt(void)
{ {
is_tripped = 1; trip_signal(SIGINT);
Handlers[SIGINT].tripped = 1;
Py_AddPendingCall((int (*)(void *))PyErr_CheckSignals, NULL);
} }
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment