@@ -101,11 +101,6 @@ def collect():
101
101
t .join ()
102
102
103
103
104
- skip_if_tsan_and_gil_disabled = unittest .skipIf (
105
- support .check_sanitizer (thread = True ) and support .Py_GIL_DISABLED ,
106
- "Test is prohibitively slow with TSAN enabled and the GIL disabled" )
107
-
108
-
109
104
class ReferencesTestCase (TestBase ):
110
105
111
106
def test_basic_ref (self ):
@@ -1260,6 +1255,12 @@ class MappingTestCase(TestBase):
1260
1255
1261
1256
COUNT = 10
1262
1257
1258
+ if support .check_sanitizer (thread = True ) and support .Py_GIL_DISABLED :
1259
+ # Reduce iteration count to get acceptable latency
1260
+ NUM_THREADED_ITERATIONS = 1000
1261
+ else :
1262
+ NUM_THREADED_ITERATIONS = 100000
1263
+
1263
1264
def check_len_cycles (self , dict_type , cons ):
1264
1265
N = 20
1265
1266
items = [RefCycle () for i in range (N )]
@@ -1882,33 +1883,30 @@ def test_make_weak_keyed_dict_repr(self):
1882
1883
self .assertRegex (repr (dict ), '<WeakKeyDictionary at 0x.*>' )
1883
1884
1884
1885
@threading_helper .requires_working_threading ()
1885
- @skip_if_tsan_and_gil_disabled
1886
1886
def test_threaded_weak_valued_setdefault (self ):
1887
1887
d = weakref .WeakValueDictionary ()
1888
1888
with collect_in_thread ():
1889
- for i in range (100000 ):
1889
+ for i in range (self . NUM_THREADED_ITERATIONS ):
1890
1890
x = d .setdefault (10 , RefCycle ())
1891
1891
self .assertIsNot (x , None ) # we never put None in there!
1892
1892
del x
1893
1893
1894
1894
@threading_helper .requires_working_threading ()
1895
- @skip_if_tsan_and_gil_disabled
1896
1895
def test_threaded_weak_valued_pop (self ):
1897
1896
d = weakref .WeakValueDictionary ()
1898
1897
with collect_in_thread ():
1899
- for i in range (100000 ):
1898
+ for i in range (self . NUM_THREADED_ITERATIONS ):
1900
1899
d [10 ] = RefCycle ()
1901
1900
x = d .pop (10 , 10 )
1902
1901
self .assertIsNot (x , None ) # we never put None in there!
1903
1902
1904
1903
@threading_helper .requires_working_threading ()
1905
- @skip_if_tsan_and_gil_disabled
1906
1904
def test_threaded_weak_valued_consistency (self ):
1907
1905
# Issue #28427: old keys should not remove new values from
1908
1906
# WeakValueDictionary when collecting from another thread.
1909
1907
d = weakref .WeakValueDictionary ()
1910
1908
with collect_in_thread ():
1911
- for i in range (200000 ):
1909
+ for i in range (2 * self . NUM_THREADED_ITERATIONS ):
1912
1910
o = RefCycle ()
1913
1911
d [10 ] = o
1914
1912
# o is still alive, so the dict can't be empty
0 commit comments