@@ -350,9 +350,10 @@ A high-level explanation of the context management protocol is:
350350
351351* The code in *BLOCK * is executed.
352352
353- * If *BLOCK * raises an exception, the :meth: `__exit__(type, value, traceback) `
354- is called with the exception details, the same values returned by
355- :func: `sys.exc_info `. The method's return value controls whether the exception
353+ * If *BLOCK * raises an exception, the context manager's :meth: `__exit__ ` method
354+ is called with three arguments, the exception details (``type, value, traceback ``,
355+ the same values returned by :func: `sys.exc_info `, which can also be ``None ``
356+ if no exception occurred). The method's return value controls whether an exception
356357 is re-raised: any false value re-raises the exception, and ``True `` will result
357358 in suppressing it. You'll only rarely want to suppress the exception, because
358359 if you do the author of the code containing the ':keyword: `with `' statement will
@@ -463,7 +464,7 @@ could be written as::
463464 with db_transaction(db) as cursor:
464465 ...
465466
466- The :mod: `contextlib ` module also has a :func: ` nested(mgr1, mgr2, ...) ` function
467+ The :mod: `contextlib ` module also has a `` nested(mgr1, mgr2, ...) ` ` function
467468that combines a number of context managers so you don't need to write nested
468469':keyword: `with `' statements. In this example, the single ':keyword: `with `'
469470statement both starts a database transaction and acquires a thread lock::
@@ -472,8 +473,9 @@ statement both starts a database transaction and acquires a thread lock::
472473 with nested (db_transaction(db), lock) as (cursor, locked):
473474 ...
474475
475- Finally, the :func: `closing(object) ` function returns *object * so that it can be
476- bound to a variable, and calls ``object.close `` at the end of the block. ::
476+ Finally, the :func: `closing ` function returns its argument so that it can be
477+ bound to a variable, and calls the argument's ``.close() `` method at the end
478+ of the block. ::
477479
478480 import urllib, sys
479481 from contextlib import closing
0 commit comments