classification
Title: threading.local doesn't support cyclic garbage collecting
Type: behavior Stage:
Components: Extension Modules, Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pitrou (1)
Priority: Keywords

Created on 2008-09-02 12:14 by pitrou, last changed 2008-09-02 12:14 by pitrou.

Messages (1)
msg72332 - (view) Author: Antoine Pitrou (pitrou) Date: 2008-09-02 12:14
tp_traverse and tp_clear on threading.local are defined, but the
Py_TPFLAGS_HAVE_GC flag is not set. As a result, cycles are not collected:

>>> import threading, weakref
>>> o = threading.local()
>>> class X(object): pass
... 
>>> x = X()
>>> x.o = o
>>> o.x = x
>>> wr = weakref.ref(x)
>>> del x, o
>>> import gc
>>> gc.collect()
0
>>> wr()
<__main__.X object at 0x9bb0dc4>
History
Date User Action Args
2008-09-02 12:14:04pitroucreate