summaryrefslogtreecommitdiffstats
path: root/Doc/reference/compound_stmts.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-28 03:18:59 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-28 03:18:59 (GMT)
commit876b2f286b9af1a69846c84d1229014b2a885c97 (patch)
tree1934d1ce119603a4ae7a0a37c01957a3ca2d17a2 /Doc/reference/compound_stmts.rst
parentd2397753ee3d20579aa60b5e1c037e9e20db7ccb (diff)
downloadcpython-876b2f286b9af1a69846c84d1229014b2a885c97.zip
cpython-876b2f286b9af1a69846c84d1229014b2a885c97.tar.gz
cpython-876b2f286b9af1a69846c84d1229014b2a885c97.tar.bz2
Merged revisions 72912,72920,72940 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines add a SETUP_WITH opcode It speeds up the with statement and correctly looks up the special methods involved. ........ r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line take into account the fact that SETUP_WITH pushes a finally block ........ r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line teach the peepholer about SETUP_WITH ........
Diffstat (limited to 'Doc/reference/compound_stmts.rst')
-rw-r--r--Doc/reference/compound_stmts.rst8
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 016ccbb..4444f18 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -354,6 +354,8 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo
#. The context expression is evaluated to obtain a context manager.
+#. The context manager's :meth:`__exit__` is loaded for later use.
+
#. The context manager's :meth:`__enter__` method is invoked.
#. If a target was included in the :keyword:`with` statement, the return value
@@ -363,9 +365,9 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo
The :keyword:`with` statement guarantees that if the :meth:`__enter__`
method returns without an error, then :meth:`__exit__` will always be
- called. Thus, if an error occurs during the assignment to the target
- list, it will be treated the same as an error occurring within the suite
- would be. See step 5 below.
+ called. Thus, if an error occurs during the assignment to the target list,
+ it will be treated the same as an error occurring within the suite would
+ be. See step 6 below.
#. The suite is executed.