[Python-Dev] Another PEP 343 contextmanager glitch

Phillip J. Eby pje at telecommunity.com
Sat Mar 25 02:04:50 CET 2006

At 04:34 PM 3/24/2006 -0800, Guido van Rossum wrote:
>You could probably tell the difference by comparing the exception it
>raises to the exception you pass it.

That's what I changed @contextmanager to do, because it's the only place 
where you have a good reason to re-raise (i.e., the generator re-raises in 
order to request propagation).

Thus, this inspection code should only have to appear in one place: 
@contextmanager, rather than it having to be in every other context that 
needs to tell the difference.

>But by all means update the PEP
>to discourage or disallow re-raising and fix any re-raising code you


By the way, I just got approval earlier this week to work on various Python 
2.5 tasks as a "20% project" at OSAF, so today's my day this week to try to 
burn through as many outstanding Python 2.5 issues as possible.  Hence all 
my activity on PEPs 342 and 343.  My current rough plans for wsgiref, 
setuptools and the rest can be found at:


if anybody's interested.

More information about the Python-Dev mailing list