mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
In a threads-disabled build, typing Ctrl-C into a raw_input() crashed,
because (essentially) I didn't realise that PY_BEGIN/END_ALLOW_THREADS actually expanded to nothing under a no-threads build, so if you somehow NULLed out the threadstate (e.g. by calling PyThread_SaveThread) it would stay NULLed when you return to Python. Argh! Backport candidate.
This commit is contained in:
parent
ad351f806d
commit
e3afc598bc
3 changed files with 11 additions and 0 deletions
|
@ -82,9 +82,13 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
#ifdef EINTR
|
||||
if (errno == EINTR) {
|
||||
int s;
|
||||
#ifdef WITH_THREAD
|
||||
PyEval_RestoreThread(_PyOS_ReadlineTState);
|
||||
#endif
|
||||
s = PyErr_CheckSignals();
|
||||
#ifdef WITH_THREAD
|
||||
PyEval_SaveThread();
|
||||
#endif
|
||||
if (s < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue