]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race...
authorSaul Cooperman <58375603+scopreon@users.noreply.github.com>
Mon, 18 May 2026 23:26:08 +0000 (16:26 -0700)
committerGitHub <noreply@github.com>
Mon, 18 May 2026 23:26:08 +0000 (16:26 -0700)
commit57a0e570d36f41b953a91bbaf4262a5d05d0391b
treedf5878cd60015899069ecb9d5fe3aa70ad5fecdc
parent56737483c2ffdaadfec648fd38d409c6b10941c0
gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (#150025)

Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
Misc/NEWS.d/next/Library/2026-05-18-15-30-34.gh-issue-146452.RM0EVJ.rst [new file with mode: 0644]
Modules/_pickle.c