You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.
Hi,
While trying to change how Trollius store tracebacks in Future.set_exception(),
I found two bugs:
* _TracebackLogger object is never deleted if its activate() method is not
called. It happens when run_until_complete() is used: the call to the
activate() method is scheduled, but it will never be executed. It happens in
many tests (test_tasks.py, test_futures.py, I don't remember which one)
* _TracebackLogger.__del__() does nothing if self.tb is None whereas self.exc
is still known
The following patch fixes these two bugs:
http://codereview.appspot.com/69350045
Remarks:
- the patch modifies Future.__del__() to have the same output on Python 3.4:
just add a trailing colon to the error message
- TestLoop.close() closes also BaseEventLoop.close() to clear _ready: it is
needed in the new unit test to remove the last reference to the _TracebackLogger
- Future.set_exception()
By default (debug mode disabled), Future.set_exception() now clears the
__traceback__ attribute of the exception to fix the reference cycle issue. So
the log of unhandled exception doesn't contain the traceback anymore. It makes
the debug much harder :-( But it avoids uncollectable objects in production.
To get the traceback, enable the debug mode of the event loop, but you might
create uncollectable objects again.
I don't know what is the best choice: keep the traceback or avoid uncollectable
objects. Is it common to use run_until_complete() and miss the call the
activate()?
At least, the change of _TracebackLogger.__del__() must be applied.
--
Even with the patch, test_tasks.test_wait_errors() still creates uncollectable
objects (Future, frames, TimerHandle, etc.) with Python 3.3. It's probably a
different bug.
Original issue reported on code.google.com by victor.s...@gmail.com on 27 Feb 2014 at 5:40
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
victor.s...@gmail.com
on 27 Feb 2014 at 5:40The text was updated successfully, but these errors were encountered: