Message29999
Logged In: YES
user_id=21627
I disagree that the circular reference is non-obvious. I'm
not sure what your application is, but I would expect that
callers of sys.exc_info should be fully aware what a
traceback is, and how it refers to the current frames. I do
agree that it is unavoidable; I fail to see that it is a bug
because of that (something unavoidable cannot be a bug).
If you are saying that it is unavoidable in your
application: I have difficulties believing this. For
example, you could do
s.e = sys.exc_info()[:2]
This would drop the traceback, and thus not create a cyclic
reference. Since, in the program you present, the traceback
is never used, this looks like a "legal" simplification (of
course, you don't use s.e at all in this program, so I can
only guess that you don't need the traceback in your real
application).
As for the time of cleanup not being controllable: you can
certainly control frequency of gc with gc.set_threshold; no
need to invoke gc explicitly.
tim_one: Why do you think your proposed modification of
introducing get_traceback would help? The frame foo still
refers to s (which is an O), and s.e will still refer to the
traceback that includes foo. |
|
Date |
User |
Action |
Args |
2007-08-23 14:43:01 | admin | link | issue1565525 messages |
2007-08-23 14:43:01 | admin | create | |
|