[ python-Bugs-1717900 ] Destructor behavior faulty

SourceForge.net noreply at sourceforge.net
Sun May 13 01:36:03 CEST 2007


Bugs item #1717900, was opened at 2007-05-12 15:41
Message generated for change (Comment added) made by alanmcintyre
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1717900&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Wolf Rogner (wrogner)
Assigned to: Nobody/Anonymous (nobody)
Summary: Destructor behavior faulty

Initial Comment:
I tried example 11.4. from bytesofpython (by C.H. Swaroop).
Example works fine.

Added a new Person instance 'wolf' -> Program terminated with:
Exception exceptions.AttributeError: "'NoneType' object has no attribute 'population'" in <bound method Person.__del__ of <__main__.Person instance at 0xb7d48d6c>> ignored

added print list(globals()) ->
['kalam', '__builtins__', '__file__', 'DBGPHideChildren', 'swaroop', 'Person', 'wolf', '__name__', '__doc__']

changed wolf to aaa:

print list(globals()) ->
['aaa', 'kalam', '__builtins__', '__file__', 'DBGPHideChildren', 'swaroop', 'Person', '__name__', '__doc__']

Please note the position of 'aaa' at the beginning of the list, before 'Person'. With 'wolf' being after 'Person'.

If the destructing code removes items in this order, no wonder I get an error.

Person should not get deleted if refcount is still > 0.

Wolf Rogner


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

Comment By: Alan McIntyre (alanmcintyre)
Date: 2007-05-12 18:36

Message:
Logged In: YES 
user_id=1115903
Originator: NO

Could you post the code for your entire script? It makes it a lot easier
to figure out what's going on.

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

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


More information about the Python-bugs-list mailing list