mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-123321: Make Parser/myreadline.c locking safe in free-threaded build (#123690)
Use a `PyMutex` to avoid the race in mutex initialization. Use relaxed atomics to avoid the data race on reading `_PyOS_ReadlineTState` when checking for re-entrant calls.
This commit is contained in:
parent
8a46a2ec50
commit
0c080d7c77
2 changed files with 11 additions and 25 deletions
|
@ -7,7 +7,7 @@ import sys
|
|||
import tempfile
|
||||
import textwrap
|
||||
import unittest
|
||||
from test.support import requires_gil_enabled, verbose
|
||||
from test.support import verbose
|
||||
from test.support.import_helper import import_module
|
||||
from test.support.os_helper import unlink, temp_dir, TESTFN
|
||||
from test.support.pty_helper import run_pty
|
||||
|
@ -351,7 +351,6 @@ readline.write_history_file(history_file)
|
|||
self.assertEqual(lines[-1].strip(), b"last input")
|
||||
|
||||
@requires_working_threading()
|
||||
@requires_gil_enabled()
|
||||
def test_gh123321_threadsafe(self):
|
||||
"""gh-123321: readline should be thread-safe and not crash"""
|
||||
script = textwrap.dedent(r"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue