Skip to content

Commit b39087a

Browse files
committed
Update test
1 parent daa45fe commit b39087a

2 files changed

Lines changed: 16 additions & 19 deletions

File tree

Lib/test/test_exceptions.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff 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-
19761957
class NameErrorTests(unittest.TestCase):
19771958
def test_name_error_has_name(self):
19781959
try:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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)

0 commit comments

Comments
 (0)