Hi,

2014-02-13 20:39 GMT+01:00 Guido van Rossum <gu...@python.org>:
> I think there should be no references to tracemalloc in the asyncio package;
> instead, there should be a hook (maybe the error handler that Yuri is
> adding???) so tracemalloc fans can help themselves.

My patch was just a proof-of-concept (using tracemalloc) to explain why I want.

> Having a new debug flag on the event loop that defaults to False sounds like
> a fine solution (I don't like the existing _DEBUG thing much anyway). Please
> make getting and setting it methods (every event loop API is a method).
> Perhaps it ought to be an integer level instead of a bool?

Here is a patch adding get_debug() and set_debug(enabled) methods to
BaseEventLoop:
http://code.google.com/p/tulip/issues/detail?id=136

The patch allows to enable slow code in debug mode, like logging slow
tasks (issue #105) or saving the traceback where a Future/Task was
created (new issue #137).

So I wrote a patch to save the traceback where a Future/Task was
created (without tracemalloc, with the classic traceback module):
http://code.google.com/p/tulip/issues/detail?id=137

If issues #136 & #137 are accepted, we can maybe simply Yury's patch
for exception handler. I proposed to pass a reference to the object
raising the exception to the exception handler because I wanted to use
tracemalloc. But it becomes useless with #137. Or maybe you want to
write exception handler which reads extra info from tranports,
protocols, handles, futures or tasks?

Victor

Reply via email to