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.
S
Saul Cooperman committed
57a0e570d36f41b953a91bbaf4262a5d05d0391b
Parent: 5673748
Committed by GitHub <noreply@github.com>
on 5/18/2026, 11:26:08 PM