From: Guido van Rossum Date: Thu, 12 Mar 1992 17:33:52 +0000 (+0000) Subject: Strip leading whitespace from input(). X-Git-Tag: v0.9.8~481 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22ebe2f4a74d61982a9c01e452c4cb914ecdbaae;p=thirdparty%2FPython%2Fcpython.git Strip leading whitespace from input(). --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 8c8d60c642d8..324ecb071a99 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, "", expr_input, d, d); }