* 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).
diff --git a/Python/ceval.c b/Python/ceval.c
index 1c12d9c..8ed4663 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -49,6 +49,9 @@
#define CHECKEXC 1 /* Double-check exception checking */
#endif
+/* Global option, may be set by main() */
+int killprint;
+
/* Forward declarations */
@@ -639,6 +642,11 @@
softspace(x, 1);
err = writeobject(v, x, 0);
flushline();
+ if (killprint) {
+ err_setstr(RuntimeError,
+ "printing expression statement");
+ x = 0;
+ }
}
DECREF(v);
break;