summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-06-24 11:10:19 (GMT)
committerGuido van Rossum <guido@python.org>1993-06-24 11:10:19 (GMT)
commit9e90a672b44e2acfd5c6dabfb9435bb4bb46c845 (patch)
treef3904d6dfed9d57f98f9e90c93241cb23cb802ad /Python/ceval.c
parent5ef74b8f8edbebe22d0b86c85f08b0c618d808f7 (diff)
downloadcpython-9e90a672b44e2acfd5c6dabfb9435bb4bb46c845.zip
cpython-9e90a672b44e2acfd5c6dabfb9435bb4bb46c845.tar.gz
cpython-9e90a672b44e2acfd5c6dabfb9435bb4bb46c845.tar.bz2
* 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).
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 8 insertions, 0 deletions
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 @@ 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;