diff Python/ceval.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 6ee380349c84
children cd397266dc1c
line wrap: on
line diff
--- a/Python/ceval.c	Wed Jun 23 11:55:24 1993 +0000
+++ b/Python/ceval.c	Thu Jun 24 11:10:19 1993 +0000
@@ -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;