Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 2857:eebbdbee54f9 legacy-trunk
be more suspicious of getlocals()
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 26 Jul 1995 16:26:31 +0000 |
| parents | 0261bf5b3819 |
| children | 04e1690fb4d1 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Wed Jul 26 16:14:30 1995 +0000 +++ b/Python/bltinmodule.c Wed Jul 26 16:26:31 1995 +0000 @@ -1105,7 +1105,8 @@ 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 @@ 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__");
