diff Python/compile.c @ 36926:fc10ff322df1 legacy-trunk

Um, I thought I'd already checked this in. Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
author Guido van Rossum <guido@python.org>
date Fri, 10 Mar 2006 02:28:35 +0000
parents 07f330ad1b47
children 9a08724110d0
line wrap: on
line diff
--- a/Python/compile.c	Fri Mar 10 02:04:28 2006 +0000
+++ b/Python/compile.c	Fri Mar 10 02:28:35 2006 +0000
@@ -1382,7 +1382,7 @@
 		case BREAK_LOOP:
 			return 0;
 		case WITH_CLEANUP:
-			return 3;
+			return -1; /* XXX Sometimes more */
 		case LOAD_LOCALS:
 			return 1;
 		case RETURN_VALUE:
@@ -3472,8 +3472,6 @@
 	!compiler_nameop(c, tmpexit, Del))
 	return 0;
     ADDOP(c, WITH_CLEANUP);
-    ADDOP_I(c, CALL_FUNCTION, 3);
-    ADDOP(c, POP_TOP);
 
     /* Finally block ends. */
     ADDOP(c, END_FINALLY);