mirror of https://github.com/python/cpython
gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)
This commit is contained in:
parent
5c488caeb8
commit
25257d61cf
|
@ -534,17 +534,14 @@ is semantically equivalent to::
|
|||
enter = type(manager).__enter__
|
||||
exit = type(manager).__exit__
|
||||
value = enter(manager)
|
||||
hit_except = False
|
||||
|
||||
try:
|
||||
TARGET = value
|
||||
SUITE
|
||||
except:
|
||||
hit_except = True
|
||||
if not exit(manager, *sys.exc_info()):
|
||||
raise
|
||||
finally:
|
||||
if not hit_except:
|
||||
else:
|
||||
exit(manager, None, None, None)
|
||||
|
||||
With more than one item, the context managers are processed as if multiple
|
||||
|
|
Loading…
Reference in New Issue