Message351082
| Author | vstinner |
|---|---|
| Recipients | Mark.Shannon, christian.heimes, jdemeyer, lukasz.langa, pablogsal, petr.viktorin, pitrou, vstinner |
| Date | 2019-09-03.12:21:13 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1567513273.65.0.888277214763.issue38006@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
I failed to write a reproducer from scratch. So let me share my notes here. The first point is that remove() function of WeakValueDictionary keeps WeakValueDictionary.data alive like that:
---
class NoisyDel:
def __del__(self):
print("dealloc data dict")
def create_closure():
data = {0: NoisyDel()}
def remove():
return data
return remove
remove = create_closure()
print("clear ")
remove = None
print("exit")
---
data is only deleted once remove is cleared. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-09-03 12:21:13 | vstinner | set | recipients: + vstinner, pitrou, christian.heimes, petr.viktorin, lukasz.langa, Mark.Shannon, jdemeyer, pablogsal |
| 2019-09-03 12:21:13 | vstinner | set | messageid: <1567513273.65.0.888277214763.issue38006@roundup.psfhosted.org> |
| 2019-09-03 12:21:13 | vstinner | link | issue38006 messages |
| 2019-09-03 12:21:13 | vstinner | create | |