[issue1918] weak references are removed before __del__ is called.

2008-03-22 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

Done in r61733.

--
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1918
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1918] weak references are removed before __del__ is called.

2008-01-23 Thread Jeff Foran

New submission from Jeff Foran:

Not sure where to put example code, but here it goes:

import weakref
class MyObj(object):
def __init__(self):
self.ref = weakref.ref(self)
def __del__(self):
print HERE123, self.ref()
o = MyObj()
o = None

--
components: Interpreter Core
messages: 61597
nosy: jforan
severity: normal
status: open
title: weak references are removed before __del__ is called.
type: behavior
versions: Python 2.5

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1918
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1918] weak references are removed before __del__ is called.

2008-01-23 Thread Christian Heimes

Christian Heimes added the comment:

The behavior is documented in the C code. I don't know how it is
described in the docs.

Objects/typeobject.c around line 820 says:

/* If we added a weaklist, we clear it.  Do this *before* calling
   the finalizer (__del__), clearing slots, or clearing the instance
   dict. */

--
nosy: +tiran
priority:  - normal
resolution:  - wont fix
status: open - pending

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1918
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1918] weak references are removed before __del__ is called.

2008-01-23 Thread Guido van Rossum

Guido van Rossum added the comment:

Georg, can you update the docs?  Weak references *to* an object are
cleared before the object's __del__ is called, to ensure that the weak
reference callback (if any) finds the object healthy.

--
assignee:  - georg.brandl
nosy: +georg.brandl, gvanrossum
status: pending - open
versions: +Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1918
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com