File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 'test_socket' ,
2121 'test_sqlite3' ,
2222 'test_ssl' ,
23- 'test_sys' ,
2423 'test_syslog' ,
2524 'test_thread' ,
2625 'test_thread_local_bytecode' ,
Original file line number Diff line number Diff line change 1+ import sys
2+ import unittest
3+ from test .support import threading_helper
4+
5+
6+ class SysModuleTest (unittest .TestCase ):
7+ def test_int_max_str_digits_thread (self ):
8+ # gh-151218: Check that it's safe to call set_int_max_str_digits()
9+ # in parallel. Previously, this test triggered warnings in TSan
10+ # on a free threaded build.
11+
12+ old_limit = sys .get_int_max_str_digits ()
13+ self .addCleanup (sys .set_int_max_str_digits , old_limit )
14+
15+ def worker ():
16+ for i in range (20_000 ):
17+ sys .set_int_max_str_digits (4300 + (i & 7 ))
18+
19+ threading_helper .run_concurrently (worker , nthreads = 4 )
20+
21+
22+ if __name__ == "__main__" :
23+ unittest .main ()
Original file line number Diff line number Diff line change @@ -1369,20 +1369,6 @@ def test_int_max_str_digits(self):
13691369 with self .assertRaises (TypeError ):
13701370 sys .set_int_max_str_digits (2_048.0 )
13711371
1372- def test_int_max_str_digits_thread (self ):
1373- # gh-151218: Check that it's safe to call set_int_max_str_digits()
1374- # in parallel. Previously, this test triggered warnings in TSan
1375- # on a free threaded build.
1376-
1377- old_limit = sys .get_int_max_str_digits ()
1378- self .addCleanup (sys .set_int_max_str_digits , old_limit )
1379-
1380- def worker ():
1381- for i in range (20_000 ):
1382- sys .set_int_max_str_digits (4300 + (i & 7 ))
1383-
1384- threading_helper .run_concurrently (worker , nthreads = 4 )
1385-
13861372
13871373@test .support .cpython_only
13881374@test .support .force_not_colorized_test_class
You can’t perform that action at this time.
0 commit comments