diff Python/compile.c @ 39364:8ef3f8cf90e1 legacy-trunk

Bug #1333982: string/number constants were inappropriately stored in the byte code and co_consts even if they were not used, ie immediately popped off the stack.
author Neal Norwitz <nnorwitz@gmail.com>
date Fri, 04 Aug 2006 05:09:28 +0000
parents b90a8b0395bd
children 9f390882a2c3
line wrap: on
line diff
--- a/Python/compile.c	Fri Aug 04 04:58:47 2006 +0000
+++ b/Python/compile.c	Fri Aug 04 05:09:28 2006 +0000
@@ -2745,11 +2745,13 @@
 	case Global_kind:
 		break;
 	case Expr_kind:
-		VISIT(c, expr, s->v.Expr.value);
 		if (c->c_interactive && c->c_nestlevel <= 1) {
+			VISIT(c, expr, s->v.Expr.value);
 			ADDOP(c, PRINT_EXPR);
 		}
-		else {
+		else if (s->v.Expr.value->kind != Str_kind &&
+			 s->v.Expr.value->kind != Num_kind) {
+			VISIT(c, expr, s->v.Expr.value);
 			ADDOP(c, POP_TOP);
 		}
 		break;