From 299a734744fb48132ca31dcac358a70b315b0d1c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 4 Mar 1992 16:39:08 +0000 Subject: Tighten error handling of string printing. --- Python/ceval.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 { -- cgit v0.12