]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-153291: Fix data race in readline.get_completer() and get_pre_input_hook() (gh...
authorHarjoth Khara <harjoth.khara@gmail.com>
Wed, 22 Jul 2026 04:42:14 +0000 (21:42 -0700)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2026 04:42:14 +0000 (21:42 -0700)
commit90b6a7992ae0ce6959eaa6b6401105582d866037
treeb0b1ee9fd77b5689c5d1b4c4ede26e4c280a6c5a
parent0e4940f0c113d8f4522ca3c120e470e9da922a8d
gh-153291: Fix data race in readline.get_completer() and get_pre_input_hook() (gh-153362)

The setters store these hooks while holding the module critical section
(via set_hook's Py_XSETREF), but the getters read and Py_NewRef the same
fields without it. Annotate both getters with @critical_section, matching
the other readline functions (gh-126895).

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Lib/test/test_free_threading/test_readline.py [new file with mode: 0644]
Lib/test/test_readline.py
Misc/NEWS.d/next/Library/2026-07-08-00-00-00.gh-issue-153291.rdlnCS.rst [new file with mode: 0644]
Modules/clinic/readline.c.h
Modules/readline.c