Issue #9707: Rewritten reference implementation of threading.local which

is friendlier towards reference cycles.  This change is not normally
visible since an optimized C implementation (_thread._local) is used
instead.
This commit is contained in:
Antoine Pitrou 2010-09-07 22:06:17 +00:00
parent 2673c5bf5e
commit 783eea722b
3 changed files with 84 additions and 84 deletions

View file

@ -184,11 +184,6 @@ class BaseLocalTest:
"""To test that subclasses behave properly."""
self._test_dict_attribute(LocalSubclass)
class ThreadLocalTest(unittest.TestCase, BaseLocalTest):
_local = _thread._local
# Fails for the pure Python implementation
def test_cycle_collection(self):
class X:
pass
@ -201,6 +196,10 @@ class ThreadLocalTest(unittest.TestCase, BaseLocalTest):
gc.collect()
self.assertIs(wr(), None)
class ThreadLocalTest(unittest.TestCase, BaseLocalTest):
_local = _thread._local
class PyThreadingLocalTest(unittest.TestCase, BaseLocalTest):
_local = _threading_local.local