On Sun, Jan 11, 2015 at 2:18 AM, Isaac Goldberg <[email protected]> wrote:
> Thanks Ben! I tried out Tornado's handling of tracebacks on Python 2 and > you're right it's pretty impressive. Prints out exactly as you'd expect > (the entire coroutine chain). > > I also noticed that Tornado supports running an entire chain of coroutines > synchronously if they never really yield ( > https://github.com/tornadoweb/tornado/blob/master/tornado/gen.py#L182) > which is more similar to the behavior of how "yield from" would behave. > Whereas the trollius backport of asyncio doesn't do so ( > https://bitbucket.org/enovance/trollius/src/8cd2101cc9ed75de7ae0c8983833522e0eaca2c0/trollius/tasks.py?at=trollius#cl-296) > but instead queues up the sub-generator to be later executed by the main > event loop. > > Am I misinterpreting the difference here? > I can't speak for the trollius implementation, but in Tornado the inline execution of coroutines was added in 4.0 as a performance optimization. It wasn't intended to make the behavior more like `yield from`, although it may have done so. -Ben > > On Sat, Jan 10, 2015 at 12:40 PM, Andrew Svetlov <[email protected] > > wrote: > >> Anyway, your traceback processing is very useful in Python 3 code >> debugging . >> Thanks to much. >> >> On Sat, Jan 10, 2015 at 10:29 PM, Ben Darnell <[email protected]> wrote: >> > FWIW, Tornado's version of Future adds exc_info and set_exc_info >> methods so >> > we can save tracebacks on python 2: >> > >> http://www.tornadoweb.org/en/stable/concurrent.html#tornado.concurrent.Future.set_exc_info >> > >> > This works pretty well for pure-tornado coroutines, although it doesn't >> help >> > if you're interacting with the backported concurrent.futures or >> trollius. >> > >> > -Ben >> > >> > On Tue, Dec 23, 2014 at 2:49 AM, Victor Stinner < >> [email protected]> >> > wrote: >> >> >> >> Hi, >> >> >> >> Backporting the whole exception feature to Python 2 is not possible. >> >> Develop with Python 3! >> >> >> >> Since the creation of Trollius, I'm trying the enhance debugging. For >> >> example, the latest release of trollius (version 1.0.4) now saves the >> >> traceback object in Future.set_exception() to be able to raise again >> the >> >> exception with the expected traceback. >> >> >> >> I'm working on a larger project to save the chain of coroutines as a >> large >> >> trabeback (stored as text) in debug mode, but for the "source >> traceback" >> >> (where rhe object was created), not for the exception traceback. I >> have a >> >> working patch on my PC. The following issue tracks the project: >> >> https://code.google.com/p/tulip/issues/detail?id=212 >> >> (The goal changed, the issue title is not correct) >> >> >> >> Victor >> > >> > >> >> >> >> -- >> Thanks, >> Andrew Svetlov >> > > > > -- > Isaac Goldberg >
