Can't you add a reference to the loop to the tb logger object? The loop should outlive any futures anyway (since the future has a reference to the loop) and it shouldn't be a ref cycle.
On Fri, Feb 7, 2014 at 11:17 AM, Yury Selivanov <[email protected]>wrote: > > On 2/6/2014, 11:02 PM, Guido van Rossum wrote: > >> On Thu, Feb 6, 2014 at 2:54 PM, Yury Selivanov<[email protected] >> >wrote: >> >> >A question to you and Guido: should the callback receive >>> >three arguments: loop, exception, and context, where >>> >context is a namedtuple (so we can add new fields to it >>> >in future releases). For now, 'context' can have two fields: >>> >'message' and 'callback'. The former is the log message, and >>> >the latter is the failed callback function (or None). >>> > >>> >> Hm... I don't like to have this much structure, but I do know that it's a >> pain to extend a callback API with new information, so I think it's a good >> idea. But maybe apart from the loop everything should be passed this way >> (i.e. also the exception)? And may I suggest to make it a dict instead of >> a >> named tuple? It's easier to check a dict for the presence of something >> that >> may or may not exist. >> >> >> While working on the patch I encountered the following problem: > event loop may not always be available, if we decide to use > the new error handling API for "futures._TracebackLogger.__del__" > and 'futures.Future.__del__". And I think that those errors > should go through the new API. > > Should we move the 'loop' callback parameter to the 'context' > dict? And make it optional too? > > Yury > -- --Guido van Rossum (python.org/~guido)
