[Python-bugs-list] [ python-Bugs-751998 ] Object destruction is broken for slots

SourceForge.net noreply@sourceforge.net
Tue, 10 Jun 2003 10:07:05 -0700


Bugs item #751998, was opened at 2003-06-10 10:55
Message generated for change (Comment added) made by jacobs99
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751998&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Kevin Jacobs (jacobs99)
Assigned to: Nobody/Anonymous (nobody)
Summary: Object destruction is broken for slots

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Kevin Jacobs (jacobs99)
Date: 2003-06-10 12:07

Message:
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...


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=751998&group_id=5470