[Python-Dev] Debugging opportunity :-) (original) (raw)
Thomas Wouters thomas at python.org
Sat Apr 15 01:11:42 CEST 2006
- Previous message: [Python-Dev] Debugging opportunity :-)
- Next message: [Python-Dev] Debugging opportunity :-)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/15/06, Thomas Wouters <thomas at python.org> wrote:
(I first thought the problem was caused by gendealloc doing 'PyDECREF(gen->genframe)' instead of 'frame = gen->genframe; gen->genframe = NULL; PyDECREF(frame)', but that isn't the case. It should do it that way, I believe, but it's not the cause of this crash.)
fixes the crash.Ah, found the problem. After I hit 'send', I realized I hadn't checked frameobject's tp_clear, and sure enough, it calls Py_XDECREF in-place. That explains why the first generator object gets dealloced twice, although it doesn't explain why it doesn't blow up when it reaches a negative refcount. Fixing frameobject and genobject to both use Py_CLEAR() makes both the 'minimal' testcase and test_generators work. Your testcase also stops leaking, but alas, test_generators still leaks 255 references..... WTF-time for me, meaning I hit the sack and not think about it until next week :)
I'll upload a patch to Tim's bugreport after I remove my debugging cruft. All tp_clear/tp_traverse methods should really always use Py_CLEAR/Py_VISIT. I guess revisiting all tp_clear and tp_traverse methods is well worth putting on the TODO list,
Bad-pun'ly y'rs,
Thomas Wouters <thomas at python.org>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060415/f8c5ecf0/attachment.html
- Previous message: [Python-Dev] Debugging opportunity :-)
- Next message: [Python-Dev] Debugging opportunity :-)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]