[Python-Dev] Another PEP 343 contextmanager glitch
Phillip J. Eby
pje at telecommunity.com
Fri Mar 24 23:40:21 CET 2006
More information about the Python-Dev mailing list
Fri Mar 24 23:40:21 CET 2006
- Previous message: [Python-Dev] PEP 342 support for string exceptions in throw()
- Next message: [Python-Dev] Another PEP 343 contextmanager glitch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
It appears that the contextmanager implementation (both in the stdlib and
as described in the PEP) doesn't correctly handle the case where the
generator yields a new value in response to throw(). It responds by
suppressing the original exception, but IIRC earlier versions of the PEP
threw a RuntimeError for this scenario.
Unless there are any objections, I'd like to restore this by replacing the
"return True" that follows the throw(), with:
raise RuntimeError("generator didn't stop after throw()")
and again, update the PEP accordingly.
- Previous message: [Python-Dev] PEP 342 support for string exceptions in throw()
- Next message: [Python-Dev] Another PEP 343 contextmanager glitch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list