[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.106, 1.1.2.107

nascheme at users.sourceforge.net nascheme at users.sourceforge.net
Fri Apr 15 03:49:27 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27593/Python

Modified Files:
      Tag: ast-branch
	newcompile.c 
Log Message:
Fix test for interactive printing of expressions.  They should be
only printed at the top-level.


Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.106
retrieving revision 1.1.2.107
diff -u -d -r1.1.2.106 -r1.1.2.107
--- newcompile.c	13 Apr 2005 19:44:40 -0000	1.1.2.106
+++ newcompile.c	15 Apr 2005 01:49:23 -0000	1.1.2.107
@@ -1388,13 +1388,9 @@
 	asdl_seq* decos = s->v.FunctionDef.decorators;
         stmt_ty st;
 	int i, n, docstring;
-	int was_interactive = c->c_interactive;
 
 	assert(s->kind == FunctionDef_kind);
 
-	/* turn off interim results from within function calls while in
-	   interactive mode */
-	c->c_interactive = 0;
 	if (!compiler_decorators(c, decos))
 		return 0;
 	if (args->defaults)
@@ -1448,9 +1444,6 @@
 		ADDOP_I(c, CALL_FUNCTION, 1);
 	}
 
-	/* turn flag back on if was interactive */
-	c->c_interactive = was_interactive;
-	
 	return compiler_nameop(c, s->v.FunctionDef.name, Store);
 }
 
@@ -2092,7 +2085,7 @@
 		break;
         case Expr_kind:
 		VISIT(c, expr, s->v.Expr.value);
-		if (c->c_interactive) {
+		if (c->c_interactive && c->c_nestlevel <= 1) {
 			ADDOP(c, PRINT_EXPR);
 		}
 		else {



More information about the Python-checkins mailing list