diff --git a/pep-0343.txt b/pep-0343.txt index 7bfbac00b..a90c46b7a 100644 --- a/pep-0343.txt +++ b/pep-0343.txt @@ -238,8 +238,8 @@ Specification: The 'with' Statement 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 @@ Specification: The 'with' Statement 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