Skip to content

Commit 60c8434

Browse files
add test
1 parent 5ea60dd commit 60c8434

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/test/test_free_threading/test_dict.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,22 @@ def reader_func():
228228

229229
self.assertEqual(count, 0)
230230

231+
def test_racing_object_get_set_dict(self):
232+
e = Exception()
233+
234+
def writer():
235+
for i in range(10000):
236+
e.__dict__ = {1:2}
237+
238+
def reader():
239+
for i in range(10000):
240+
e.__dict__
241+
242+
t1 = Thread(target=writer)
243+
t2 = Thread(target=reader)
244+
245+
with threading_helper.start_threads([t1, t2]):
246+
pass
231247

232248
if __name__ == "__main__":
233249
unittest.main()

0 commit comments

Comments
 (0)