[Python-Dev] Evil reference cycles caused Exception.__traceback__
Antoine Pitrou
solipsis at pitrou.net
Mon Sep 18 06:50:31 EDT 2017
More information about the Python-Dev mailing list
Mon Sep 18 06:50:31 EDT 2017
- Previous message (by thread): [Python-Dev] Evil reference cycles caused Exception.__traceback__
- Next message (by thread): [Python-Dev] Evil reference cycles caused Exception.__traceback__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 18 Sep 2017 20:07:42 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote: > On 18 September 2017 at 19:48, Antoine Pitrou <solipsis at pitrou.net> wrote: > > On Mon, 18 Sep 2017 11:31:12 +0200 > > Victor Stinner <victor.stinner at gmail.com> wrote: > >> > >> Ideally, CPython 3.x should never create reference cycles. Removing > >> Exception.__traceback__ is the obvious "fix" for the issue. But I > >> expect that slowly, a lot of code started to rely on the attribute, > >> maybe even for good reasons :-) > > > > The real issue is not reference cycles, but the fact that a traceback > > frame keeps all locals alive. When the frame's execution is finished, > > that information is practically almost always useless, but is kept for > > the rare cases of debugging (and perhaps dubious features such as > > some of py.test's magic). > > As another use case, IPython tracebacks will include details of > referenced local variables, and > https://docs.python.org/3/library/traceback.html#tracebackexception-objects > offers the ability to readily capture the repr() of locals referenced > from a traceback for the same reason. True... but interactive use has different concerns than production use (hence my proposition of a setting to change frame cleanup behaviour). Besides, IPython also stores the history of displayed values, which is another cause of keeping objects alive :-) Regards Antoine.
- Previous message (by thread): [Python-Dev] Evil reference cycles caused Exception.__traceback__
- Next message (by thread): [Python-Dev] Evil reference cycles caused Exception.__traceback__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list