diff options
author | Guido van Rossum <guido@python.org> | 1997-11-07 19:20:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-07 19:20:34 (GMT) |
commit | f51815426e065740386b2a5b81c23832f11e27c7 (patch) | |
tree | 03406031b672d80300e0583140f86f233a883d36 | |
parent | c1189eb52421ff384d6d9252bb1acc03016051e3 (diff) | |
download | cpython-f51815426e065740386b2a5b81c23832f11e27c7.zip cpython-f51815426e065740386b2a5b81c23832f11e27c7.tar.gz cpython-f51815426e065740386b2a5b81c23832f11e27c7.tar.bz2 |
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...
-rw-r--r-- | Objects/fileobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index a0d05c4..cd8a730 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -541,18 +541,18 @@ getline(f, n) for (;;) { if ((c = getc(fp)) == EOF) { clearerr(fp); + Py_BLOCK_THREADS if (PyErr_CheckSignals()) { - Py_BLOCK_THREADS Py_DECREF(v); return NULL; } if (n < 0 && buf == BUF(v)) { - Py_BLOCK_THREADS Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF when reading a line"); return NULL; } + Py_UNBLOCK_THREADS break; } if ((*buf++ = c) == '\n') { |