But wouldn't keeping the traceback (on cancel) be just as detrimental as keeping the callback/args?
On Fri, Jul 4, 2014 at 4:23 AM, Victor Stinner <[email protected]> wrote: > Hi, > > 2014-07-04 1:19 GMT+02:00 Guido van Rossum <[email protected]>: > > There's also the solution that was proposed a long time ago but never > > implemented (because it's using a somewhat complex heuristic): > occasionally > > remove cancelled timers from the heapq. This is what pyftpdlib uses. > > This can be more expensive than just clearing references in .cancel(). > > > I've got a feeling that occasionally it might be useful to have the > > callback+args show up in a handler's repr(), even if it is cancelled, but > > I'm not sure how valuable that is in practice. > > In debug mode, the traceback where a Handle was created is now stored > in a Handle object. We can enhance repr(Handle) to show the most > recent frame where the object was created, "filename:lineno" or even > the content of the line. The line content is already stored in the > _source_traceback list. IMO it's enough to identify a Handle object. > > IMO it's enough, so it's fine to clear the reference to callback and > args on Handle.cancel(). > > Victor > -- --Guido van Rossum (python.org/~guido)
