MCPcopy Index your code
hub / github.com/python/cpython / test_gh123321_threadsafe

Method test_gh123321_threadsafe

Lib/test/test_readline.py:373–393  ·  view source on GitHub ↗

gh-123321: readline should be thread-safe and not crash

(self)

Source from the content-addressed store, hash-verified

371
372 @requires_working_threading()
373 def test_gh123321_threadsafe(self):
374 """gh-123321: readline should be thread-safe and not crash"""
375 script = textwrap.dedent(r"""
376 import threading
377 from test.support.threading_helper import join_thread
378
379 def func():
380 input()
381
382 thread1 = threading.Thread(target=func)
383 thread2 = threading.Thread(target=func)
384 thread1.start()
385 thread2.start()
386 join_thread(thread1)
387 join_thread(thread2)
388 print("done")
389 """)
390
391 output = run_pty(script, input=b"input1\rinput2\r")
392
393 self.assertIn(b"done", output)
394
395
396 def test_write_read_limited_history(self):

Callers

nothing calls this directly

Calls 3

run_ptyFunction · 0.90
assertInMethod · 0.80
dedentMethod · 0.45

Tested by

no test coverage detected