Re: [Python-Dev] What is the precise problem? [was: Reference cycles in Exception.__traceback__]

2014年3月08日 07:16:31 -0800

2014年03月08日 14:33 GMT+01:00 Antoine Pitrou <[email protected]>:
> Ok, it's actually quite trivial. The whole chain is kept alive by the
> "fut" global variable. If you arrange for it to be disposed of:
>
> fut = asyncio.Future()
> asyncio.Task(func(fut))
> del fut
> [etc.]
>
> then the problem disappears: as soon as gc.collect() happens, the
> MyObject instance is destroyed, the future is collected, and the
> future's traceback is printed out.
Well, the problem is more general than this specific example. I would
like to implement a general solution which would not hold references
to local variables, to destroy objects when Python exits the except
block.
It looks like a "exception summary" containing only data to format the
traceback would fit asyncio needs. If you don't want it in the
traceback module, I will try to implement it in asyncio.
It would be nice to provide an "exception summary" in the traceback
module, because it looks like reference cycles related to exception
and/or traceback is a common issue (see the list of links I gave in a
previous email).
Victor
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to