File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Lib/test/test_free_threading Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 11import unittest
2- import sys
32from threading import Thread , Barrier
43from test .support import threading_helper
54
65threading_helper .requires_working_threading (module = True )
76
8- class BytesThreading (unittest .TestCase ):
97
8+ class BytesThreading (unittest .TestCase ):
109 @threading_helper .reap_threads
1110 def test_conversion_from_list (self ):
1211 number_of_threads = 10
1312 number_of_iterations = 10
1413 barrier = Barrier (number_of_threads )
1514
1615 x = [1 , 2 , 3 , 4 , 5 ]
17- e = [ (ii ,)* (2 + 4 * ii ) for ii in range (number_of_threads )] # range of sizes to extend
16+ extends = [(ii ,) * (2 + ii ) for ii in range (number_of_threads )]
17+
1818 def work (ii ):
1919 barrier .wait ()
2020 for _ in range (1000 ):
2121 bytes (x )
22- x .extend (e [ii ])
22+ x .extend (extends [ii ])
2323 if len (x ) > 10 :
2424 x [:] = [0 ]
2525
2626 for it in range (number_of_iterations ):
2727 worker_threads = []
2828 for ii in range (number_of_threads ):
29- worker_threads .append (
30- Thread (target = work , args = [ii ]))
29+ worker_threads .append (Thread (target = work , args = [ii ]))
3130 with threading_helper .start_threads (worker_threads ):
3231 pass
3332
3433 barrier .reset ()
3534
35+
3636if __name__ == "__main__" :
3737 unittest .main ()
You can’t perform that action at this time.
0 commit comments