[Python-ideas] feature to make traceback objects usable without references to frame locals and globals

ghazel at gmail.com ghazel at gmail.com
Sat Jun 26 13:35:31 CEST 2010


On Sat, Jun 26, 2010 at 4:03 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> Greg Ewing wrote:
>> I'd like to take this further and remove the need for
>> traceback objects to refer to a frame object at all.
>> The standard traceback printout only needs two pieces of
>> information from the traceback, the file name and line
>> number.

First off, Greg Ewing's idea fully covers my use case and may even
simplify implementation, so I'm in favor it. I have never used (and
very much question the use of) references to locals and globals.
Having some backwards-compatible way to avoid ever having to deal with
them would be preferable.

On Sat, Jun 26, 2010 at 4:03 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> Greg Ewing wrote:
>> ghazel at gmail.com wrote:
>>
>>> I'm interested in a feature which allows users to discard the locals
>>> and globals references from frames held by a traceback object.
>
> Wouldn't it be better to write safer code and not store
> a reference to the traceback object in the first place ?
>
> Working with traceback objects can easily introduce hidden
> circular references, so it usually better not access them
> at all, if you don't have a need for them:

Those are strong words against using traceback objects. This feature
idea is about creating a way to make traceback objects usable without
the gotcha you're referencing.


-Greg



More information about the Python-ideas mailing list