This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年01月23日 18:34 by jforan, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg61597 - (view) | Author: Jeff Foran (jforan) | Date: 2008年01月23日 18:34 | |
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 |
|||
| msg61600 - (view) | Author: Christian Heimes (christian.heimes) * (Python committer) | Date: 2008年01月23日 20:21 | |
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. */ |
|||
| msg61604 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年01月23日 20:56 | |
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. |
|||
| msg64317 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年03月22日 10:07 | |
Done in r61733. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:30 | admin | set | github: 46213 |
| 2008年03月22日 10:07:41 | georg.brandl | set | status: open -> closed messages: + msg64317 |
| 2008年01月23日 20:56:28 | gvanrossum | set | status: pending -> open assignee: georg.brandl messages: + msg61604 nosy: + gvanrossum, georg.brandl versions: + Python 2.6, Python 3.0 |
| 2008年01月23日 20:21:37 | christian.heimes | set | status: open -> pending priority: normal resolution: wont fix messages: + msg61600 nosy: + christian.heimes |
| 2008年01月23日 18:34:14 | jforan | create | |