mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
printobject now returns an error code
This commit is contained in:
parent
dd0108081b
commit
909336104b
10 changed files with 70 additions and 86 deletions
|
@ -192,8 +192,10 @@ builtin_input(self, v)
|
|||
int err;
|
||||
object *m, *d;
|
||||
flushline();
|
||||
if (v != NULL)
|
||||
printobject(v, out, PRINT_RAW);
|
||||
if (v != NULL) {
|
||||
if (printobject(v, out, PRINT_RAW) != 0)
|
||||
return NULL;
|
||||
}
|
||||
m = add_module("__main__");
|
||||
d = getmoduledict(m);
|
||||
return run_file(in, "<stdin>", expr_input, d, d);
|
||||
|
@ -450,8 +452,10 @@ builtin_raw_input(self, v)
|
|||
{
|
||||
FILE *out = sysgetfile("stdout", stdout);
|
||||
flushline();
|
||||
if (v != NULL)
|
||||
printobject(v, out, PRINT_RAW);
|
||||
if (v != NULL) {
|
||||
if (printobject(v, out, PRINT_RAW) != 0)
|
||||
return NULL;
|
||||
}
|
||||
return filegetline(sysget("stdin"), -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ eval_code(co, globals, locals, arg)
|
|||
if (v != None) {
|
||||
flushline();
|
||||
softspace(sysget("stdout"), 1);
|
||||
printobject(v, fp, 0);
|
||||
err = printobject(v, fp, 0);
|
||||
flushline();
|
||||
}
|
||||
DECREF(v);
|
||||
|
@ -447,7 +447,7 @@ eval_code(co, globals, locals, arg)
|
|||
softspace(sysget("stdout"), 0);
|
||||
}
|
||||
else {
|
||||
printobject(v, fp, 0);
|
||||
err = printobject(v, fp, 0);
|
||||
}
|
||||
DECREF(v);
|
||||
break;
|
||||
|
@ -933,7 +933,8 @@ prtrace(v, str)
|
|||
char *str;
|
||||
{
|
||||
printf("%s ", str);
|
||||
printobject(v, stdout, 0);
|
||||
if (printobject(v, stdout, 0) != 0)
|
||||
err_clear(); /* Don't know what else to do */
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue