[ python-Bugs-1377858 ] segfaults when using __del__ and weakrefs
SourceForge.net
noreply at sourceforge.net
Mon Jan 9 12:54:43 CET 2006
Bugs item #1377858, was opened at 2005-12-10 21:20
Message generated for change (Comment added) made by mwh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&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: Python 2.4
Status: Open
Resolution: None
Priority: 7
Submitted By: Carl Friedrich Bolz (cfbolz)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfaults when using __del__ and weakrefs
Initial Comment:
You can segfault Python by creating a weakref to an
object in its __del__ method, storing it somewhere and
then trying to dereference the weakref afterwards. the
attached file shows the described behaviour.
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2006-01-09 11:54
Message:
Logged In: YES
user_id=6656
Hmm, I was kind of hoping this report would get more attention.
The problem is obvious if you read typeobject.c around line 660: the weakref
list is cleared before __del__ is called, so any weakrefs added during the
execution of __del__ are never informed of the object's death. One fix for this
would be to clear the weakref list _after_ calling __del__ but that led to other
mayhem in ways I haven't boethered to understand <wink> (see SF bug
#742911). I guess we could just clear out any weakrefs created in __del__
without calling their callbacks.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&group_id=5470
More information about the Python-bugs-list
mailing list