Skip to content

Commit 11f7e16

Browse files
committed
Run test in a subprocess.
1 parent 32e7415 commit 11f7e16

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_atexit.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def test_atexit_instances(self):
5252
@unittest.skipUnless(support.Py_GIL_DISABLED, "only meaningful without the GIL")
5353
def test_atexit_thread_safety(self):
5454
# GH-126907: atexit was not thread safe on the free-threaded build
55+
source = """
5556
from threading import Thread
5657
5758
def dummy():
@@ -67,9 +68,14 @@ def thready():
6768
6869
6970
threads = [Thread(target=thready) for _ in range(100)]
70-
with threading_helper.start_threads(threads):
71-
pass
71+
for thread in threads:
72+
thread.start()
73+
74+
for thread in threads:
75+
thread.join()
76+
"""
7277

78+
assert_python_ok(textwrap.dedent(source))
7379

7480
@support.cpython_only
7581
class SubinterpreterTest(unittest.TestCase):

0 commit comments

Comments
 (0)