From 9e90a672b44e2acfd5c6dabfb9435bb4bb46c845 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 24 Jun 1993 11:10:19 +0000 Subject: * 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). --- Python/ceval.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Python/ceval.c') diff --git a/Python/ceval.c b/Python/ceval.c index 1c12d9cbc2..8ed4663424 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -49,6 +49,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define CHECKEXC 1 /* Double-check exception checking */ #endif +/* Global option, may be set by main() */ +int killprint; + /* Forward declarations */ @@ -639,6 +642,11 @@ eval_code(co, globals, locals, owner, arg) softspace(x, 1); err = writeobject(v, x, 0); flushline(); + if (killprint) { + err_setstr(RuntimeError, + "printing expression statement"); + x = 0; + } } DECREF(v); break; -- cgit v1.2.1