[Python-checkins] r88784 - peps/trunk/pep-0343.txt
georg.brandl
python-checkins at python.org
Sun Mar 20 22:51:37 CET 2011
Author: georg.brandl
Date: Sun Mar 20 22:51:37 2011
New Revision: 88784
Log:
#11248: look up special methods on type.
Modified:
peps/trunk/pep-0343.txt
Modified: peps/trunk/pep-0343.txt
==============================================================================
--- peps/trunk/pep-0343.txt (original)
+++ peps/trunk/pep-0343.txt Sun Mar 20 22:51:37 2011
@@ -238,8 +238,8 @@
The translation of the above statement is:
mgr = (EXPR)
- exit = mgr.__exit__ # Not calling it yet
- value = mgr.__enter__()
+ exit = type(mgr).__exit__ # Not calling it yet
+ value = type(mgr).__enter__(mgr)
exc = True
try:
try:
@@ -248,13 +248,13 @@
except:
# The exceptional case is handled here
exc = False
- if not exit(*sys.exc_info()):
+ if not exit(mgr, *sys.exc_info()):
raise
# The exception is swallowed if exit() returns true
finally:
# The normal and non-local-goto cases are handled here
if exc:
- exit(None, None, None)
+ exit(mgr, None, None, None)
Here, the lowercase variables (mgr, exit, value, exc) are internal
variables and not accessible to the user; they will most likely be
More information about the Python-checkins
mailing list