[issue3757] threading.local doesn't support cyclic garbage collecting

Antoine Pitrou report at bugs.python.org
Wed Aug 4 02:13:58 CEST 2010

Antoine Pitrou <pitrou at free.fr> added the comment:

This is a patch. It modifies the implementation to use intermediate dummy objects and various weakrefs. This allows to break reference cycles even when the thread state dict is still alive (because it isn't involved in the ref cycles anymore). This also has the benefit of fixing another wart, which is still present in the pure Python implementation, though (see "_threading_local keeps the local of the last stopped thread alive" in test_threading_local).

The pure Python implementation should probably be updated, or perhaps removed altogether (since the C version is always compiled anyway).

keywords: +patch
nosy: +gps
stage:  -> patch review
Added file: http://bugs.python.org/file18363/threadlocal.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list