@@ -1953,56 +1953,6 @@ def iter_reduce(b, a, it):
19531953 # iterator stuff
19541954 self .check ([clear ] + [iter_next ] * 10 , a := array .array ('i' , [1 ] * 10 ), iter (a ))
19551955
1956- @unittest .skipUnless (support .check_sanitizer (thread = True ), 'meant for tsan' )
1957- @threading_helper .reap_threads
1958- @threading_helper .requires_working_threading ()
1959- def test_free_threading_tsan (self ):
1960- def copy_back_and_forth (b , a , count ):
1961- b .wait ()
1962- for _ in range (count ):
1963- a [0 ] = a [1 ]
1964- a [1 ] = a [0 ]
1965-
1966- def append_and_pop (b , a , count ):
1967- v = a [0 ]
1968- b .wait ()
1969- for _ in range (count ):
1970- a .append (v )
1971- a .pop ()
1972-
1973- def copy_random (b , a , count ):
1974- end = len (a ) - 1
1975- idxs = [(random .randint (0 , end ), random .randint (0 , end )) for _ in range (count )]
1976- b .wait ()
1977- for src , dst in idxs :
1978- a [dst ] = a [src ]
1979-
1980- # comment these back in if resize is made atomically quiet
1981- # def extend_range(b, a, count):
1982- # b.wait()
1983- # for _ in range(count):
1984- # a.extend(range(10))
1985-
1986- # def extend_self(b, a, count):
1987- # c = a[:]
1988- # b.wait()
1989- # for _ in range(count):
1990- # a.extend(c)
1991-
1992- for tc in typecodes :
1993- if tc in 'uw' :
1994- a = array .array (tc , 'ab' )
1995- else :
1996- a = array .array (tc , [0 , 1 ])
1997-
1998- self .check ([copy_back_and_forth ] * 10 , a , 100 )
1999- self .check ([append_and_pop ] * 10 , a , 100 )
2000- # self.check([copy_back_and_forth] * 10 + [extend_self], a, 100) # comment this in if resize is made atomically quiet
2001-
2002- if tc not in 'uw' :
2003- # self.check([copy_back_and_forth] * 10 + [extend_range], a, 100) # comment this in if resize is made atomically quiet
2004- self .check ([copy_random ] * 10 , a * 5 , 100 )
2005-
20061956
20071957if __name__ == "__main__" :
20081958 unittest .main ()
0 commit comments