mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Darn. When thread support is disabled, the BEGIN/END macros don't
save and restore the tstate, but explicitly calling PyEval_SaveThread() does reset it! While I think about how to fix this for real, here's a fix that avoids getting a fatal error.
This commit is contained in:
parent
04d5c5827a
commit
a59406abdf
2 changed files with 8 additions and 4 deletions
|
|
@ -168,8 +168,10 @@ on_completion(text, state)
|
|||
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(tstate);
|
||||
r = PyObject_CallFunction(completer, "si", text, state);
|
||||
if (r == NULL)
|
||||
|
|
@ -190,6 +192,7 @@ on_completion(text, state)
|
|||
Py_XDECREF(r);
|
||||
done:
|
||||
PyEval_SaveThread();
|
||||
PyThreadState_Swap(save_tstate);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue