Skip to content

[3.14] gh-146452: Improve locking granularity in pickle's batch_dict_…#150062

Merged
JelleZijlstra merged 1 commit into
python:3.14from
scopreon:backport-57a0e57-3.14
May 19, 2026
Merged

[3.14] gh-146452: Improve locking granularity in pickle's batch_dict_…#150062
JelleZijlstra merged 1 commit into
python:3.14from
scopreon:backport-57a0e57-3.14

Conversation

@scopreon
Copy link
Copy Markdown
Contributor

@scopreon scopreon commented May 19, 2026

…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 57a0e57)

…_dict_exact and fix race condition (pythonGH-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 57a0e57)

Co-authored-by: Saul Cooperman <58375603+scopreon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants