Issue 10150: Local references not released after exception (original) (raw)
Issue10150
Created on 2010-10-20 04:01 by James.Bowman, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg119187 - (view) | Author: James Bowman (James.Bowman) | Date: 2010-10-20 04:01 |
import sys def foo(): x = [o] * 100 raise ArithmeticError o = "something" print sys.getrefcount(o) try: foo() except ArithmeticError: pass print sys.getrefcount(o) ------------------------------------------- Gives: 4 104 Looking at the CPython source, FrameObject's deallocator does actually decrement refcounts of its locals and arguments. Guessing that the FrameObject is not being deallocated. | ||
msg119188 - (view) | Author: Alex Gaynor (alex) * ![]() |
Date: 2010-10-20 04:58 |
That's because in Python 2.5 at that point in the code sys.exc_info() still points at the traceback (and by extension, the frame) thus x is not deallocated yet. I don't think this is a bug. | ||
msg119190 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2010-10-20 06:22 |
Alex is correct. (You can prove that by raising and catching another exception before the second getrefcount().) |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:07 | admin | set | github: 54359 |
2010-10-20 06:22:07 | georg.brandl | set | status: open -> closednosy: + georg.brandlmessages: + resolution: wont fix |
2010-10-20 04:58:36 | alex | set | nosy: + alexmessages: + |
2010-10-20 04:01:45 | James.Bowman | create |