(original) (raw)
On 6 Mar 2014 08:32, "Yury Selivanov" <yselivanov.ml@gmail.com> wrote:
\>
\>
\> On 2014-03-05, 4:54 PM, Nick Coghlan wrote:
\>>
\>> On 6 Mar 2014 02:43, "Antoine Pitrou" <solipsis@pitrou.net> wrote:
\>>>
\>>> Le 05/03/2014 17:37, Victor Stinner a �crit :
\>>>
\>>>> Python 3.4 introduced frame.clear(), but frame.clear() raises an
\>>>> RuntimeError if the frame is still running. And it doesn't break all
\>>>> reference cycles.
\>>>>
\>>>> An obvious workaround is to store the traceback as text, but this
\>>>> operation is "expensive" especially if the traceback is only needed in
\>>>> rare cases.
\>>>
\>>>
\>>> Another "obvious" workaround is to call frame.clear() from the parent
\>>
\>> function (i.e. have a dedicated wrapping layer).
\>>
\>> Guido had a fix in mind - splitting traceback formatting into two pieces.
\>> The first would convert a traceback to a sequence of named tuples, the
\>> second would do the actual string formatting.
\>
\>
\> I don't like the idea of using tuples instead of tracebacks
\> in 'exception.\_\_traceback\_\_'. �Lots of introspection and logging
\> tools except to find tracebacks in exceptions, and do custom
\> formatting or submitting data to remote servers for further
\> analysis (sometimes with values of local variables in frames).
\> If asyncio starts stripping exception.\_\_traceback\_\_ and using
\> namedtuples, it will make it harder to write/integrate such
\> tools.
\_\_traceback\_\_ wouldn't change - this is a variant on Victor's point that it is currently easy to store the already formatted traceback as a string, but that wastes time formatting a string you may never display, and is hard to manipulate programmatically.
Extracting a traceback summary from \_\_traceback\_\_ instead can address both limitations.
Cheers,
Nick.
>
\> Yury
\>
\> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\> Python-Dev mailing list
\> Python-Dev@python.org
\> https://mail.python.org/mailman/listinfo/python-dev
\> Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com