diff options
author | Guido van Rossum <guido@python.org> | 1991-07-27 21:40:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-07-27 21:40:24 (GMT) |
commit | 278ef591107ef670d164d070d2c42e30bc903d57 (patch) | |
tree | 9b635d9c7ac8104b2b634e105b2ce780443305f2 /Objects | |
parent | 139e57b2a46cada3b7911bd59816b97bb4326552 (diff) | |
download | cpython-278ef591107ef670d164d070d2c42e30bc903d57.zip cpython-278ef591107ef670d164d070d2c42e30bc903d57.tar.gz cpython-278ef591107ef670d164d070d2c42e30bc903d57.tar.bz2 |
Check for write errors after printing a value
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c index 79c12f2..2000f03 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -67,6 +67,7 @@ printobject(op, fp, flags) FILE *fp; int flags; { + int ret = 0; if (intrcheck()) { err_set(KeyboardInterrupt); return -1; @@ -81,9 +82,16 @@ printobject(op, fp, flags) fprintf(fp, "<%s object at %lx>", op->ob_type->tp_name, (long)op); else - return (*op->ob_type->tp_print)(op, fp, flags); + ret = (*op->ob_type->tp_print)(op, fp, flags); } - return 0; + if (ret == 0) { + if (ferror(fp)) { + err_errno(RuntimeError); + clearerr(fp); + ret = -1; + } + } + return ret; } object * |