[Python-Dev] PEP 479 and asyncio
Victor Stinner
victor.stinner at gmail.com
Fri Nov 28 11:02:10 CET 2014
2014-11-28 3:49 GMT+01:00 Nick Coghlan <ncoghlan at gmail.com>:
> I think between contextlib and Trollius, the case is starting to be
> made for raising an UnhandledStopIteration subclass of RuntimeError,
> rather than a generic RuntimeError.
I modified Trollius to test such idea:
* Return inherits from Exception (not from StopIteration)
* on Python 3, @trollius.coroutine wraps the coroutine to catch
Runtimerror: if the exc.__context__ is a StopIteration, return
exc.__context__.value
The test suite pass with such additional coroutine wrapper on Python
3.5 patched with pep479.patch (and unpatched Python 3.3).
So yes, it may help to have a new specialized exception, even if "it
works" with RuntimeError.
The drawback is that a new layer would make trollius even slower.
Victor
More information about the Python-Dev
mailing list