]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-153291: Fix data race in readline.get_completer() and get_pre_input_hook...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 22 Jul 2026 17:54:26 +0000 (19:54 +0200)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2026 17:54:26 +0000 (10:54 -0700)
commit7dca47d7fade29d8d7e6725ed9782682cb9703ce
treeda4a3d607b00b8e5af89617282fdcb0acffa5159
parentf0728d31cde7b6d7928865fd1780b83ce0634413
[3.15] gh-153291: Fix data race in readline.get_completer() and get_pre_input_hook() (gh-153362) (gh-154418)

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).

(cherry picked from commit 90b6a7992ae0ce6959eaa6b6401105582d866037)

Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
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