summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-25 13:13:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-25 13:13:44 (GMT)
commit1880d8b8231d0085700d5d3c03ee9b16c619720d (patch)
tree5ee56e8c0e04567dd7fb793a5c510007f623e3f3 /Doc/reference
parent179bf213ea0432f2219c9b72ff4c4e18062fb588 (diff)
downloadcpython-1880d8b8231d0085700d5d3c03ee9b16c619720d.zip
cpython-1880d8b8231d0085700d5d3c03ee9b16c619720d.tar.gz
cpython-1880d8b8231d0085700d5d3c03ee9b16c619720d.tar.bz2
add a SETUP_WITH opcode
It speeds up the with statement and correctly looks up the special methods involved.
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/compound_stmts.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 3c716b2..afb7ebc 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -339,6 +339,8 @@ The execution of the :keyword:`with` statement proceeds as follows:
#. 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
@@ -349,7 +351,7 @@ The execution of the :keyword:`with` statement proceeds as follows:
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.
+ same as an error occurring within the suite would be. See step 6 below.
#. The suite is executed.