[ python-Bugs-1500167 ] interpret termination, object deleting
SourceForge.net
noreply at sourceforge.net
Sat Jun 3 20:55:31 CEST 2006
Bugs item #1500167, was opened at 2006-06-03 20:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1500167&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jan Martinek (johnymart)
Assigned to: Nobody/Anonymous (nobody)
Summary: interpret termination, object deleting
Initial Comment:
Hello,
I found out a strange behavior. This code
#!/usr/bin/python
class M:
b = 0
def __del__(self):
M.b = 0
a1 = M()
results in exception when the program terminates.
Exception exceptions.AttributeError: "'NoneType' object
has no attribute 'b'" in <bound method M.__del__ of
<__main__.M instance at 0x2aaaaab50a28>> ignored
Note that the code must be run from an executable file
-not from the python interpretter. Otherwise the
exception is not thrown.
An interesting thing is that changing the last line to
a = M()
also prevents python from throwing the exception. Why
does it depend on variable's name?
bye
Jan Martinek
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1500167&group_id=5470
More information about the Python-bugs-list
mailing list