mirror of https://github.com/python/cpython
Merge 3.3
This commit is contained in:
commit
8c01ffa6ed
|
@ -279,11 +279,12 @@ Functions and classes provided:
|
||||||
|
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
files = [stack.enter_context(open(fname)) for fname in filenames]
|
files = [stack.enter_context(open(fname)) for fname in filenames]
|
||||||
close_files = stack.pop_all().close()
|
# Hold onto the close method, but don't call it yet.
|
||||||
|
close_files = stack.pop_all().close
|
||||||
# If opening any file fails, all previously opened files will be
|
# If opening any file fails, all previously opened files will be
|
||||||
# closed automatically. If all files are opened successfully,
|
# closed automatically. If all files are opened successfully,
|
||||||
# they will remain open even after the with statement ends.
|
# they will remain open even after the with statement ends.
|
||||||
# close_files() can then be invoked explicitly to close them all
|
# close_files() can then be invoked explicitly to close them all.
|
||||||
|
|
||||||
.. method:: close()
|
.. method:: close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue