[Python-checkins] cpython (merge 3.1 -> 3.1): merge
raymond.hettinger
python-checkins at python.org
Tue Apr 19 20:15:48 CEST 2011
http://hg.python.org/cpython/rev/240e964fbd42
changeset: 69450:240e964fbd42
branch: 3.1
parent: 69444:15afaf8aa155
parent: 69433:8b7b3748f876
user: Raymond Hettinger <python at rcn.com>
date: Tue Apr 19 11:12:47 2011 -0700
summary:
merge
files:
Doc/c-api/init.rst | 2 +-
Lib/test/test_startfile.py | 5 +++++
Misc/NEWS | 6 ++++++
Modules/signalmodule.c | 26 ++++++++++++++++----------
4 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -892,7 +892,7 @@
main thread where it has possession of the global interpreter lock and can
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()
diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py
--- a/Lib/test/test_startfile.py
+++ b/Lib/test/test_startfile.py
@@ -11,6 +11,7 @@
from test import support
import os
from os import path
+from time import sleep
startfile = support.get_attribute(os, 'startfile')
@@ -23,6 +24,10 @@
empty = path.join(path.dirname(__file__), "empty.vbs")
startfile(empty)
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():
support.run_unittest(TestCase)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,10 @@
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
specific part only digits. Patch by Santoso Wijaya.
@@ -314,6 +318,8 @@
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
platforms. Patch by Nadeem Vawda.
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -164,6 +164,20 @@
}
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
signal_handler(int sig_num)
{
int save_errno = errno;
@@ -180,13 +194,7 @@
if (getpid() == main_pid)
#endif
{
- Handlers[sig_num].tripped = 1;
- /* 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);
+ trip_signal(sig_num);
}
#ifndef HAVE_SIGACTION
@@ -932,9 +940,7 @@
void
PyErr_SetInterrupt(void)
{
- is_tripped = 1;
- Handlers[SIGINT].tripped = 1;
- Py_AddPendingCall((int (*)(void *))PyErr_CheckSignals, NULL);
+ trip_signal(SIGINT);
}
void
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list