mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Strip leading whitespace from input().
This commit is contained in:
parent
27aaa6daa9
commit
22ebe2f4a7
1 changed files with 4 additions and 0 deletions
|
@ -317,6 +317,7 @@ builtin_input(self, v)
|
||||||
FILE *out = sysgetfile("stdout", stdout);
|
FILE *out = sysgetfile("stdout", stdout);
|
||||||
node *n;
|
node *n;
|
||||||
int err;
|
int err;
|
||||||
|
int c;
|
||||||
object *m, *d;
|
object *m, *d;
|
||||||
flushline();
|
flushline();
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
|
@ -325,6 +326,9 @@ builtin_input(self, v)
|
||||||
}
|
}
|
||||||
m = add_module("__main__");
|
m = add_module("__main__");
|
||||||
d = getmoduledict(m);
|
d = getmoduledict(m);
|
||||||
|
while ((c = getc(in)) != EOF && (c == ' ' || c == '\t'))
|
||||||
|
;
|
||||||
|
ungetc(c, in);
|
||||||
return run_file(in, "<stdin>", expr_input, d, d);
|
return run_file(in, "<stdin>", expr_input, d, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue