Commit f5181542 authored by Guido van Rossum's avatar Guido van Rossum

Fix problem discovered by Barry: if you hit ^C to

sys.stdin.readline(), you get a fatal error (no current thread).  This
is because there was a call to PyErr_CheckSignals() while there was no
current thread.  I wonder how many more of these we find...  I bnetter
go hunting for PyErr_CheckSignals() now...
parent c1189eb5
...@@ -541,18 +541,18 @@ getline(f, n) ...@@ -541,18 +541,18 @@ getline(f, n)
for (;;) { for (;;) {
if ((c = getc(fp)) == EOF) { if ((c = getc(fp)) == EOF) {
clearerr(fp); clearerr(fp);
Py_BLOCK_THREADS
if (PyErr_CheckSignals()) { if (PyErr_CheckSignals()) {
Py_BLOCK_THREADS
Py_DECREF(v); Py_DECREF(v);
return NULL; return NULL;
} }
if (n < 0 && buf == BUF(v)) { if (n < 0 && buf == BUF(v)) {
Py_BLOCK_THREADS
Py_DECREF(v); Py_DECREF(v);
PyErr_SetString(PyExc_EOFError, PyErr_SetString(PyExc_EOFError,
"EOF when reading a line"); "EOF when reading a line");
return NULL; return NULL;
} }
Py_UNBLOCK_THREADS
break; break;
} }
if ((*buf++ = c) == '\n') { if ((*buf++ = c) == '\n') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment