summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2004-07-07 17:44:12 (GMT)
committerMichael W. Hudson <mwh@python.net>2004-07-07 17:44:12 (GMT)
commit30ea2f223f5c0a85a13bd893063555a9f587cd6d (patch)
treed9ad0b824eb899d1163043d982dd7d961b11a263 /Python
parente3c330b42a5dbc64a254354e906885134a852949 (diff)
downloadcpython-30ea2f223f5c0a85a13bd893063555a9f587cd6d.zip
cpython-30ea2f223f5c0a85a13bd893063555a9f587cd6d.tar.gz
cpython-30ea2f223f5c0a85a13bd893063555a9f587cd6d.tar.bz2
This closes patch:
[ 960406 ] unblock signals in threads although the changes do not correspond exactly to any patch attached to that report. Non-main threads no longer have all signals masked. A different interface to readline is used. The handling of signals inside calls to PyOS_Readline is now rather different. These changes are all a bit scary! Review and cross-platform testing much appreciated.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c3
-rw-r--r--Python/ceval.c2
-rw-r--r--Python/pythonrun.c3
-rw-r--r--Python/thread_pthread.h11
4 files changed, 5 insertions, 14 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3604601..10e59c9 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1589,7 +1589,8 @@ builtin_raw_input(PyObject *self, PyObject *args)
prompt);
Py_XDECREF(po);
if (s == NULL) {
- PyErr_SetNone(PyExc_KeyboardInterrupt);
+ if (!PyErr_Occurred())
+ PyErr_SetNone(PyExc_KeyboardInterrupt);
return NULL;
}
if (*s == '\0') {
diff --git a/Python/ceval.c b/Python/ceval.c
index 0c3a93d..39b7633 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -318,7 +318,7 @@ static volatile int things_to_do = 0;
int
Py_AddPendingCall(int (*func)(void *), void *arg)
{
- static int busy = 0;
+ static volatile int busy = 0;
int i, j;
/* XXX Begin critical section */
/* XXX If you want this to be safe against nested
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 113ff2d..d89e5e9 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1435,7 +1435,8 @@ err_input(perrdetail *err)
msg = "EOL while scanning single-quoted string";
break;
case E_INTR:
- PyErr_SetNone(PyExc_KeyboardInterrupt);
+ if (!PyErr_Occurred())
+ PyErr_SetNone(PyExc_KeyboardInterrupt);
Py_XDECREF(v);
return;
case E_NOMEM:
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index d18d2de..dd1616c 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -119,7 +119,6 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
{
pthread_t th;
int status;
- sigset_t oldmask, newmask;
#if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
pthread_attr_t attrs;
#endif
@@ -137,13 +136,6 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
#endif
- /* Mask all signals in the current thread before creating the new
- * thread. This causes the new thread to start with all signals
- * blocked.
- */
- sigfillset(&newmask);
- SET_THREAD_SIGMASK(SIG_BLOCK, &newmask, &oldmask);
-
status = pthread_create(&th,
#if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
&attrs,
@@ -154,9 +146,6 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
(void *)arg
);
- /* Restore signal mask for original thread */
- SET_THREAD_SIGMASK(SIG_SETMASK, &oldmask, NULL);
-
#if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
pthread_attr_destroy(&attrs);
#endif