From: Guido van Rossum Date: Fri, 7 Nov 1997 19:20:34 +0000 (+0000) Subject: Fix problem discovered by Barry: if you hit ^C to X-Git-Tag: v1.5b1~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f51815426e065740386b2a5b81c23832f11e27c7;p=python 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... --- diff --git a/Objects/fileobject.c b/Objects/fileobject.c index a0d05c485b..cd8a730954 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') {