You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 103c022
Browse filesBrowse the repository at this point in the historyBrowse files
Wrap pairwise.__next__ in a critical section so concurrent callers from
different threads serialize cleanly in the free-threaded build, and add
a re-entrancy guard so a same-thread re-entrant call (e.g. when the
input iterator's __next__ calls back into pairwise.__next__) raises
RuntimeError instead of crashing or producing garbled output. Matches
the long-standing behavior of itertools.tee and of generators, and
fixes the use-after-free crash reported in pythongh-149557.
With re-entry blocked, po->old is safe as a borrowed reference for the
duration of __next__, so the defensive incref/decref and re-read guard
added by pythongh-109788 are no longer needed and have been removed.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
0 commit comments