You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
weak references are removed before __del__ is called. #46213
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/birkenfeld'closed_at=<Date2008-03-22.10:07:41.710>created_at=<Date2008-01-23.18:34:14.454>labels= ['interpreter-core', 'type-bug']
title='weak references are removed before __del__ is called.'updated_at=<Date2008-03-22.10:07:41.698>user='https://bugs.python.org/jforan'
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.
Activity
jforan commentedon Jan 23, 2008
Not sure where to put example code, but here it goes:
tiran commentedon Jan 23, 2008
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. */
gvanrossum commentedon Jan 23, 2008
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.
birkenfeld commentedon Mar 22, 2008
Done in r61733.