Author belopolsky
Recipients belopolsky, benjamin.peterson, michael.foord
Date 2011-02-02.19:46:01
SpamBayes Score 1.38223e-14
Marked as misclassified No
Message-id <1296675964.53.0.729033742653.issue4724@psf.upfronthosting.co.za>
In-reply-to
Content
Not applicable to 3.x because the frame object does not have f_exc_traceback attribute anymore:

>>> import sys;sys._getframe(0).f_exc_traceback = 23
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'frame' object has no attribute 'f_exc_traceback'

The issue is present in 2.7 but appears to be rather benign.   It looks like the worst that can happen in non-debug build is a reference leak in set_exc_info().

I am not sure if this is worth fixing.  If this was affecting development version, I would argue that the simplest fix is to disallow setting f_exc_traceback or f_exc_value before f_exc_type is set.  In a bug-fix reliase, however this is probably not acceptable.

Given that sys._getframe() screams "beware, expert use only", I am not sure anything should be done other than possibly documenting that assigning to f_exc_* attributes of a transient frame object is not a good idea.

Note that the following works:

>>> f = sys._getframe(0)
>>> f.f_exc_traceback = 23

If there is a legitimate use for setting f_exc_traceback, the user should know to set f.f_exc_type and f.f_exc_value as well.
History
Date User Action Args
2011-02-02 19:46:04belopolskysetrecipients: + belopolsky, benjamin.peterson, michael.foord
2011-02-02 19:46:04belopolskysetmessageid: <1296675964.53.0.729033742653.issue4724@psf.upfronthosting.co.za>
2011-02-02 19:46:01belopolskylinkissue4724 messages
2011-02-02 19:46:01belopolskycreate