mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Tighten error handling of string printing.
This commit is contained in:
parent
2ba9f30489
commit
299a734744
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue