Clarify the expanded code -- exc is just used as a flag.
This commit is contained in:
parent
f038797f00
commit
d8e895c878
|
@ -228,17 +228,19 @@ Specification: The 'with' Statement
|
|||
ctx = (EXPR).__context__()
|
||||
exit = exc.__exit__ # Not calling it yet
|
||||
value = ctx.__enter__()
|
||||
exc = (None, None, None)
|
||||
exc = True
|
||||
try:
|
||||
try:
|
||||
VAR = value # Only if "as VAR" is present
|
||||
BLOCK
|
||||
except:
|
||||
exc = None
|
||||
# The exceptional case is handled here
|
||||
exc = False
|
||||
exit(*sys.exc_info())
|
||||
finally:
|
||||
# The normal and non-local-goto cases are handled here
|
||||
if exc:
|
||||
exit(*exc)
|
||||
exit(None, None, None)
|
||||
|
||||
Here, the lowercase variables (ctx, exit, value, exc) are internal
|
||||
variables and not accessible to the user; they will most likely be
|
||||
|
|
Loading…
Reference in New Issue