]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Skip leading whitespace of eval() string argument.
authorGuido van Rossum <guido@python.org>
Wed, 4 Mar 1992 16:41:41 +0000 (16:41 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 4 Mar 1992 16:41:41 +0000 (16:41 +0000)
Python/bltinmodule.c

index bf4d3fd9ed6c549d0ba0843498561755c0b8e3e4..8c8d60c642d84cb0c29b4c50028308a66bafbc40 100644 (file)
@@ -148,6 +148,7 @@ exec_eval(v, start)
        int start;
 {
        object *str = NULL, *globals = NULL, *locals = NULL;
+       char *s;
        int n;
        if (v != NULL) {
                if (is_stringobject(v))
@@ -167,7 +168,12 @@ exec_eval(v, start)
                    "exec/eval arguments must be string[,dict[,dict]]");
                return NULL;
        }
-       return run_string(getstringvalue(str), start, globals, locals);
+       s = getstringvalue(str);
+       if (start == eval_input) {
+               while (*s == ' ' || *s == '\t')
+                       s++;
+       }
+       return run_string(s, start, globals, locals);
 }
 
 static object *