Check for write errors after printing a value
This commit is contained in:
parent
139e57b2a4
commit
278ef59110
|
@ -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 *
|
||||
|
|
Loading…
Reference in New Issue