summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-03-12 17:33:52 (GMT)
committerGuido van Rossum <guido@python.org>1992-03-12 17:33:52 (GMT)
commit22ebe2f4a74d61982a9c01e452c4cb914ecdbaae (patch)
treee4b5a5c78563c55fb7a9f0f39bcaf0d8ad03b817 /Python/bltinmodule.c
parent27aaa6daa941ed945a0d200c1598b467e7a8bc3b (diff)
downloadcpython-22ebe2f4a74d61982a9c01e452c4cb914ecdbaae.zip
cpython-22ebe2f4a74d61982a9c01e452c4cb914ecdbaae.tar.gz
cpython-22ebe2f4a74d61982a9c01e452c4cb914ecdbaae.tar.bz2
Strip leading whitespace from input().
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8c8d60c..324ecb0 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -317,6 +317,7 @@ builtin_input(self, v)
FILE *out = sysgetfile("stdout", stdout);
node *n;
int err;
+ int c;
object *m, *d;
flushline();
if (v != NULL) {
@@ -325,6 +326,9 @@ builtin_input(self, v)
}
m = add_module("__main__");
d = getmoduledict(m);
+ while ((c = getc(in)) != EOF && (c == ' ' || c == '\t'))
+ ;
+ ungetc(c, in);
return run_file(in, "<stdin>", expr_input, d, d);
}