]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-144295: Fix data race in dict method lookup and global load (gh-144312...
authorSam Gross <colesbury@gmail.com>
Fri, 30 Jan 2026 17:15:47 +0000 (12:15 -0500)
committerGitHub <noreply@github.com>
Fri, 30 Jan 2026 17:15:47 +0000 (12:15 -0500)
commit06f9c8ca1cb9abe92507108a299a65ee868d07e3
treef91df81130b7d89bc45604dec1f50ce59ed015a9
parent49ce23f2d706401526d54be7f28136e4b5104cbb
[3.14] gh-144295: Fix data race in dict method lookup and global load (gh-144312) (#144346)

In `_Py_dict_lookup_threadsafe_stackref`, call `ensure_shared_on_read()` to
prevent a race between the lookup and concurrent dict resizes, which may free
the PyDictKeysObject (i.e., it ensures that the resize uses QSBR).

(cherry picked from commit e666a01ef42939f77f4c22ca47a610df5ef8b7ab)
Lib/test/test_free_threading/test_dict.py
Objects/dictobject.c