+What's New in Python 2.2.3
+Release date: XX-XXX-2003
+==========================
+
+- XXX There's more, but nobody has updated NEWS so far.
+
+- Fixed broken threadstate swap in readline that could cause fatal
+ errors when a readline hook was being invoked while a background
+ thread was active. (SF bugs #660476 and #513033.)
+
What's New in Python 2.2.2 (final) ?
Release date: 14-Oct-2002
====================================
/* C function to call the Python hooks. */
static int
-on_hook(PyObject *func, PyThreadState *tstate)
+on_hook(PyObject *func, PyThreadState **tstate)
{
int result = 0;
if (func != NULL) {
PyObject *r;
- PyThreadState *save_tstate;
/* Note that readline is called with the interpreter
lock released! */
- save_tstate = PyThreadState_Swap(NULL);
- PyEval_RestoreThread(tstate);
+ PyEval_RestoreThread(*tstate);
r = PyObject_CallFunction(func, NULL);
if (r == NULL)
goto error;
PyErr_Clear();
Py_XDECREF(r);
done:
- PyEval_SaveThread();
- PyThreadState_Swap(save_tstate);
+ *tstate = PyEval_SaveThread();
}
return result;
}
static int
on_startup_hook(void)
{
- return on_hook(startup_hook, startup_hook_tstate);
+ return on_hook(startup_hook, &startup_hook_tstate);
}
#ifdef HAVE_RL_PRE_INPUT_HOOK
static int
on_pre_input_hook(void)
{
- return on_hook(pre_input_hook, pre_input_hook_tstate);
+ return on_hook(pre_input_hook, &pre_input_hook_tstate);
}
#endif
char *result = NULL;
if (completer != NULL) {
PyObject *r;
- PyThreadState *save_tstate;
/* Note that readline is called with the interpreter
lock released! */
- save_tstate = PyThreadState_Swap(NULL);
PyEval_RestoreThread(completer_tstate);
r = PyObject_CallFunction(completer, "si", text, state);
if (r == NULL)
PyErr_Clear();
Py_XDECREF(r);
done:
- PyEval_SaveThread();
- PyThreadState_Swap(save_tstate);
+ completer_tstate = PyEval_SaveThread();
}
return result;
}