diff options
author | Guido van Rossum <guido@python.org> | 1992-08-04 12:41:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-08-04 12:41:02 (GMT) |
commit | 1984f1e1c6306d4e8073c28d2395638f80ea509b (patch) | |
tree | 4366039e7665e689aef04549c3e3d73f99bdab32 /Objects/fileobject.c | |
parent | 4fbf798f866b10ee50cc91a394d19c0d4b2f79ab (diff) | |
download | cpython-1984f1e1c6306d4e8073c28d2395638f80ea509b.zip cpython-1984f1e1c6306d4e8073c28d2395638f80ea509b.tar.gz cpython-1984f1e1c6306d4e8073c28d2395638f80ea509b.tar.bz2 |
* Makefile adapted to changes below.
* split pythonmain.c in two: most stuff goes to pythonrun.c, in the library.
* new optional built-in threadmodule.c, build upon Sjoerd's thread.{c,h}.
* new module from Sjoerd: mmmodule.c (dynamically loaded).
* new module from Sjoerd: sv (svgen.py, svmodule.c.proto).
* new files thread.{c,h} (from Sjoerd).
* new xxmodule.c (example only).
* myselect.h: bzero -> memset
* select.c: bzero -> memset; removed global variable
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index b026413..99f4e5e 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -321,6 +321,7 @@ getline(f, n) fileobject *f; int n; { + void *save, *save_thread(), restore_thread(); register FILE *fp; register int c; register char *buf, *end; @@ -334,16 +335,19 @@ getline(f, n) return NULL; buf = BUF(v); end = buf + n2; - + + save = save_thread(); for (;;) { if ((c = getc(fp)) == EOF) { clearerr(fp); if (intrcheck()) { + restore_thread(save); DECREF(v); err_set(KeyboardInterrupt); return NULL; } if (n < 0 && buf == BUF(v)) { + restore_thread(save); DECREF(v); err_setstr(EOFError, "EOF when reading a line"); @@ -361,13 +365,16 @@ getline(f, n) break; n1 = n2; n2 += 1000; + restore_thread(save); if (resizestring(&v, n2) < 0) return NULL; + save = save_thread(); buf = BUF(v) + n1; end = BUF(v) + n2; } } - + restore_thread(save); + n1 = buf - BUF(v); if (n1 != n2) resizestring(&v, n1); |