mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
2673c5bf5e
commit
783eea722b
3 changed files with 84 additions and 84 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue