Issue751998
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003-06-10 15:55 by jacobs99, last changed 2022-04-10 16:09 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
newfin.diff | jacobs99, 2003-06-10 18:19 | Patch to fix this problem |
Messages (9) | |||
---|---|---|---|
msg16329 - (view) | Author: Kevin Jacobs (jacobs99) | Date: 2003-06-10 15:55 | |
The following code worked without errors in Python 2.3b1, but seems to be broken in the current Python 2.3 CVS: class Foo(object): __slots__ = ('bar','__dict__') def __init__(self): self.bar = 1 self.baz = 2 def __del__(self): print 'In __del__.' print ' baz =',self.baz print ' bar =',self.bar foo=Foo() Python 2.3b1: No error, output: In __del__. baz = 2 bar = 1 However, the current CVS outputs: In __del__. baz = 2 Exception exceptions.AttributeError: 'bar' in <bound method Foo.__del__ of <__main__.Foo object at 0x403ace6c>> ignored Somehow, descriptor lookup seems to be failing in objects that are in the process of being deleted, since commenting out the __slots__ declaration makes the problem go away. I wish I had time to look into this, but I'm currently swamped. Hopefully this is the result of something recent and this report will trigger some light-bulbs. If not, I'll see if I can make time next week. As it stands, I see this as a serious bug, since it prevents finalization from completing on these objects. |
|||
msg16330 - (view) | Author: Kevin Jacobs (jacobs99) | Date: 2003-06-10 17:07 | |
Logged In: YES user_id=459565 The fix checked in to solve Bug 751998 is the cause of this potentially more serious one bug. I have yet to figure out why, though I have isolated the problem to revision 2.234 of typeobject.c. I've not looked to see if this also affects Python 2.2.3, though I wouldn't be too suprised if it does. More soon, hopefully. Maybe... |
|||
msg16331 - (view) | Author: Kevin Jacobs (jacobs99) | Date: 2003-06-10 18:19 | |
Logged In: YES user_id=459565 Okay, I had a few minutes free. The problem is that slots are being deallocated too early -- before tp_dealloc. I'm attaching a patch that corrects this at the expense of having to travel up the path of base class tp_dealloc entries twice. Here is the new sequence of actions: 1) Find the nearest base with a different tp_dealloc 2) Clear weakrefs 3) Call finalizer 4) Check to see if object was resurrected, if so stop 5) Clear all slots up to nearest base with a different tp_dealloc 6) DECREF dict pointer, if necessary 7) proceed as usual... (call basedealloc, DECREF type, etc.) Without my patch, step number 5 is done as part of step 1, and bad things happen. |
|||
msg16332 - (view) | Author: Kevin Jacobs (jacobs99) | Date: 2003-06-10 18:21 | |
Logged In: YES user_id=459565 Oh, and with the patch, 'make test' completes without any new errors, my attached test case works, as does the minimal test case associated with Bug 751998. |
|||
msg16333 - (view) | Author: Kevin Jacobs (jacobs99) | Date: 2003-06-10 18:24 | |
Logged In: YES user_id=459565 er, see Bug 742911 instead. |
|||
msg16334 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2003-06-13 19:42 | |
Logged In: YES user_id=6380 Thanks! Fixed in CVS for 2.3. This should be backported to 2.2 too; assiged to Neal Norwitz for that purpose. |
|||
msg16335 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2003-06-13 20:41 | |
Logged In: YES user_id=33168 Hmm, did you check anything in? The report says it's broken in CVS, but works in 2.3b1. It is still broken for me without the patch. Did you want me to test the patch and then backport? |
|||
msg16336 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2003-06-13 20:57 | |
Logged In: YES user_id=6380 Sorry, the checkin barfed and I didn't notice. Try again now. |
|||
msg16337 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2003-06-16 23:38 | |
Logged In: YES user_id=33168 Checked in a test too: * Lib/test/test_descr.py 1.194, 1.113.4.34 * Objects/typeobject.c 2.126.4.39 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:09:08 | admin | set | github: 38626 |
2003-06-10 15:55:03 | jacobs99 | create |