File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1954,25 +1954,6 @@ def test_exec_set_nomemory_hang(self):
19541954 self .assertGreater (len (output ), 0 ) # At minimum, should not hang
19551955 self .assertIn (b"MemoryError" , output )
19561956
1957- def test_data_race (self ):
1958- from threading import Thread
1959- import copy
1960-
1961- E = Exception ()
1962-
1963- def func ():
1964- for i in range (100 ):
1965- setattr (E , 'x' , i )
1966- copy .copy (E )
1967-
1968- threads = [Thread (target = func ) for _ in range (4 )]
1969-
1970- for t in threads :
1971- t .start ()
1972-
1973- for t in threads :
1974- t .join ()
1975-
19761957class NameErrorTests (unittest .TestCase ):
19771958 def test_name_error_has_name (self ):
19781959 try :
Original file line number Diff line number Diff line change 1+ import unittest
2+ import copy
3+
4+ from test .support import threading_helper
5+
6+ threading_helper .requires_working_threading (module = True )
7+ class ExceptionTests (unittest .TestCase ):
8+ def test_setstate_data_race (self ):
9+ E = Exception ()
10+
11+ def func ():
12+ for i in range (100 ):
13+ setattr (E , 'x' , i )
14+ copy .copy (E )
15+
16+ threading_helper .run_concurrently (func , nthreads = 4 )
You can’t perform that action at this time.
0 commit comments