[Python-checkins] python/nondist/peps pep-0343.txt,1.7,1.8

gvanrossum@users.sourceforge.net gvanrossum at users.sourceforge.net
Sat May 14 19:36:17 CEST 2005


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7347

Modified Files:
	pep-0343.txt 
Log Message:
__exit__ is always called with 3 args.


Index: pep-0343.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0343.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- pep-0343.txt	14 May 2005 05:20:21 -0000	1.7
+++ pep-0343.txt	14 May 2005 17:36:15 -0000	1.8
@@ -158,7 +158,7 @@
     The translation of the above statement is:
 
         abc = EXPR
-        exc = ()  # Or (None, None, None) ?
+        exc = (None, None, None)
         try:
             try:
                 VAR = abc.__enter__()
@@ -167,7 +167,7 @@
                 exc = sys.exc_info()
                 raise
         finally:
-            abc.__exit__(exc)
+            abc.__exit__(*exc)
 
     Here, the variables 'abc' and 'exc' are internal variables and not
     accessible to the user; they will most likely be implemented as
@@ -178,12 +178,11 @@
 
     The calling convention for abc.__exit__() is: as follows.  If the
     finally-suite was reached through normal completion of BLOCK or
-    through a non-local goto (a break, continue or return statement
-    in BLOCK), abc.__exit__() is called without arguments (or perhaps
-    with three None arguments?).  If the finally-suite was reached
-    through an exception raised in BLOCK, abc.__exit__() is called
-    with three arguments representing the exception type, value, and
-    traceback.
+    through a non-local goto (a break, continue or return statement in
+    BLOCK), abc.__exit__() is called with three None arguments.  If
+    the finally-suite was reached through an exception raised in
+    BLOCK, abc.__exit__() is called with three arguments representing
+    the exception type, value, and traceback.
 
     The motivation for this API to __exit__(), as opposed to the
     argument-less __exit__() from PEP 310, was given by the



More information about the Python-checkins mailing list