Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ditto
  • Loading branch information
neonene authored Jul 13, 2025
commit df7ae54c8c776262916b68a198b8be5262acda58
29 changes: 12 additions & 17 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7295,26 +7295,21 @@ def test_update_type_cache(self):
""")
script_helper.assert_python_ok('-c', script)

@support.skip_if_pgo_task
@unittest.skipIf(_interpreters is None, "missing _interpreters module")
def test_static_type_concurrent_init_fini(self):
# gh-136421
script = textwrap.dedent("""
import threading
import _interpreters

def run(id):
_interpreters.exec(id, "import _datetime; print('a', end='')")
_interpreters.destroy(id)

ids = [_interpreters.create() for i in range(10)]
ts = [threading.Thread(target=run, args=(id,)) for id in ids]
for t in ts:
t.start()
for t in ts:
t.join()
""")
res = script_helper.assert_python_ok('-c', script)
self.assertEqual(res.out, b'a' * 10)
from concurrent.futures import InterpreterPoolExecutor
def func():
import _datetime
print('a', end='')
with InterpreterPoolExecutor() as executor:
for _ in range(8):
executor.submit(func)
""")
_, out, err = script_helper.assert_python_ok("-c", script)
self.assertEqual(out, b'a' * 8)
self.assertEqual(err, b'')


def load_tests(loader, standard_tests, pattern):
Expand Down
Loading