]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-146452: Improve locking granularity in pickle's batch_dict_… (#150062)
authorSaul Cooperman <58375603+scopreon@users.noreply.github.com>
Tue, 19 May 2026 12:34:06 +0000 (05:34 -0700)
committerGitHub <noreply@github.com>
Tue, 19 May 2026 12:34:06 +0000 (05:34 -0700)
commit1243cd677d7f62b90c50546c5ff27e26ef24ca4f
treef12c7a6c47d49359933fda7be58c27a982dff0c7
parent8e13025747e1ca72e86d1f35637123f9c306f0cb
[3.14] gh-146452: Improve locking granularity in pickle's batch_dict_… (#150062)

[3.14] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-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.
(cherry picked from commit 57a0e570d36f41b953a91bbaf4262a5d05d0391b)
Misc/NEWS.d/next/Library/2026-05-18-15-30-34.gh-issue-146452.RM0EVJ.rst [new file with mode: 0644]
Modules/_pickle.c