]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
be more suspicious of getlocals()
authorGuido van Rossum <guido@python.org>
Wed, 26 Jul 1995 16:26:31 +0000 (16:26 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 26 Jul 1995 16:26:31 +0000 (16:26 +0000)
Python/bltinmodule.c

index 0be037397ab60966d0b8287cd53cf8e6c6447ae5..21562ae71b90b1499b923fcd820b2937f676743e 100644 (file)
@@ -1105,7 +1105,8 @@ builtin_raw_input(self, args)
        if (!newgetargs(args, "|O:[raw_]input", &v))
                return NULL;
        if (getfilefile(sysget("stdin")) == stdin &&
-           getfilefile(sysget("stdout")) == stdout) {
+           getfilefile(sysget("stdout")) == stdout &&
+           isatty(fileno(stdin)) && isatty(fileno(stdout))) {
                object *po;
                char *prompt;
                char *s;
@@ -1366,7 +1367,12 @@ builtin_vars(self, args)
                return NULL;
        if (v == NULL) {
                d = getlocals();
-               INCREF(d);
+               if (d == NULL) {
+                       if (!err_occurred())
+                               err_setstr(SystemError, "no locals!?");
+               }
+               else
+                       INCREF(d);
        }
        else {
                d = getattr(v, "__dict__");