Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

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.

----------
nosy: +belopolsky -BreamoreBoy
versions:  -Python 3.1, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4724>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to