Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/contextlib.py

    r2 r388  
    33import sys
    44from functools import wraps
     5from warnings import warn
    56
    67__all__ = ["contextmanager", "nested", "closing"]
     
    8788@contextmanager
    8889def nested(*managers):
    89     """Support multiple context managers in a single with-statement.
     90    """Combine multiple context managers into a single nested context manager.
    9091
    91     Code like this:
     92   This function has been deprecated in favour of the multiple manager form
     93   of the with statement.
    9294
    93         with nested(A, B, C) as (X, Y, Z):
    94             <body>
     95   The one advantage of this function over the multiple manager form of the
     96   with statement is that argument unpacking allows it to be
     97   used with a variable number of context managers as follows:
    9598
    96     is equivalent to this:
    97 
    98         with A as X:
    99             with B as Y:
    100                 with C as Z:
    101                     <body>
     99      with nested(*managers):
     100          do_something()
    102101
    103102    """
     103    warn("With-statements now directly support multiple context managers",
     104         DeprecationWarning, 3)
    104105    exits = []
    105106    vars = []
Note: See TracChangeset for help on using the changeset viewer.