Change abstract to avoid the implication that the problem is specific to contextlib.nested
This commit is contained in:
parent
cd484999f2
commit
0065f32940
10
pep-0377.txt
10
pep-0377.txt
|
@ -16,9 +16,13 @@ Abstract
|
||||||
|
|
||||||
This PEP proposes a backwards compatible mechanism that allows ``__enter__()``
|
This PEP proposes a backwards compatible mechanism that allows ``__enter__()``
|
||||||
methods to skip the body of the associated ``with`` statment. The lack of
|
methods to skip the body of the associated ``with`` statment. The lack of
|
||||||
this ability currently means the ``contextlib.nested`` context manager
|
this ability currently means the ``contextlib.contextmanager`` decorator
|
||||||
is unable to fulfil its specification of being equivalent to writing out
|
is unable to fulfil its specification of being able to turn arbitrary
|
||||||
multiple nested ``with`` statements [1].
|
code into a context manager by moving it into a generator function
|
||||||
|
with a yield in the appropriate location. One symptom of this is that
|
||||||
|
``contextlib.nested`` will currently raise ``RuntimeError`` in
|
||||||
|
situations where writing out the corresponding nested ``with``
|
||||||
|
statements would not [1].
|
||||||
|
|
||||||
The proposed change is to introduce a new flow control exception
|
The proposed change is to introduce a new flow control exception
|
||||||
``SkipStatement``, and skip the execution of the ``with``
|
``SkipStatement``, and skip the execution of the ``with``
|
||||||
|
|
Loading…
Reference in New Issue