diff options
author | Guido van Rossum <guido@python.org> | 1995-07-26 16:26:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-07-26 16:26:31 (GMT) |
commit | 53bb7fff11cb07ba48dd30aca8c956dec0986a00 (patch) | |
tree | 81c2dab60d0e1583ad3c273659caa9ba1edc2e0e | |
parent | bdd207af79d55d5aa11d00f56313929eb92d1822 (diff) | |
download | cpython-53bb7fff11cb07ba48dd30aca8c956dec0986a00.zip cpython-53bb7fff11cb07ba48dd30aca8c956dec0986a00.tar.gz cpython-53bb7fff11cb07ba48dd30aca8c956dec0986a00.tar.bz2 |
be more suspicious of getlocals()
-rw-r--r-- | Python/bltinmodule.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 0be0373..21562ae 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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__"); |