Mercurial > cpython-lru_cache-weakref
diff Python/frozenmain.c @ 1318:92e6a8cf14be legacy-trunk
* pythonmain.c: -k option, usage message, more environment flags.
(the latter also in frozenmain.c)
* ceval.c: global 'killprint' flag raises exception when printing an
expression statement's value (useful for finding stray output)
* timemodule.c: add asctime() and ctime(). Change julian date to
1-based origin (as intended and documented).
* Removed unused DO_TIMES stuff from timemodule.c. Added 'epoch' and
'day0' globals (year where time.time() == 0 and day of the week the
epoch started).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 24 Jun 1993 11:10:19 +0000 |
| parents | 14369a5e6167 |
| children | cd397266dc1c |
line wrap: on
line diff
--- a/Python/frozenmain.c Wed Jun 23 11:55:24 1993 +0000 +++ b/Python/frozenmain.c Thu Jun 24 11:10:19 1993 +0000 @@ -30,28 +30,43 @@ extern int debugging; extern int verbose; +extern int killprint; main(argc, argv) int argc; char **argv; { char *p; + int n, inspect, sts; int n; + if ((p = getenv("PYTHONDEBUG")) && *p != '\0') debugging = 1; if ((p = getenv("PYTHONVERBOSE")) && *p != '\0') verbose = 1; - initargs(&argc, &argv); /* Defined in config*.c */ + if ((p = getenv("PYTHONINSPECT")) && *p != '\0') + inspect = 1; + if ((p = getenv("PYTHONKILLPRINT")) && *p != '\0') + killprint = 1; + + initargs(&argc, &argv); initall(); setpythonargv(argc, argv); + n = init_frozen("__main__"); if (n == 0) fatal("__main__ not frozen"); if (n < 0) { print_error(); - goaway(1); + sts = 1; } else - goaway(0); + sts = 0; + + if (inspect && isatty((int)fileno(stdin)) && + (filename != NULL || command != NULL)) + sts = run(stdin, "<stdin>") != 0; + + goaway(sts); /*NOTREACHED*/ }
