[issue5251] contextlib.nested inconsistent with, well, nested with statements due exceptions raised in __enter__

Nick Coghlan report at bugs.python.org
Wed Feb 25 12:37:03 CET 2009


Nick Coghlan <ncoghlan at gmail.com> added the comment:

That's an interesting problem... since one of the things I like about
CMs is the ability to turn pretty much any block of code into a context
manager by substituting a yield statement at the appropriate point, not
having the ability to skip the yield is actually something of a hole in
the design.

This will need a bit of python-dev discussion, and may even turn into a
PEP (assuming we do go ahead with adding a SkipBlock exception and
modifying the with statement to check for it being raised by __enter__()
methods).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5251>
_______________________________________


More information about the Python-bugs-list mailing list