diff options
author | Guido van Rossum <guido@python.org> | 1992-03-04 16:39:08 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-03-04 16:39:08 (GMT) |
commit | 299a734744fb48132ca31dcac358a70b315b0d1c (patch) | |
tree | 01f2d6a132a14f117f66513bc048f05f54170bea /Python | |
parent | 2ba9f30489326dcaea8e0c1fdc395805fb618c97 (diff) | |
download | cpython-299a734744fb48132ca31dcac358a70b315b0d1c.zip cpython-299a734744fb48132ca31dcac358a70b315b0d1c.tar.gz cpython-299a734744fb48132ca31dcac358a70b315b0d1c.tar.bz2 |
Tighten error handling of string printing.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 1c3a610..3e0c76a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -532,7 +532,11 @@ eval_code(co, globals, locals, arg) char *s = getstringvalue(v); int len = getstringsize(v); fwrite(s, 1, len, fp); - if (len > 0 && s[len-1] == '\n') + if (ferror(fp)) { + err_errno(IOError); + err = -1; + } + else if (len > 0 && s[len-1] == '\n') softspace(sysget("stdout"), 0); } else { |