gh-145142: Make str.maketrans safe under free-threading#145157
Conversation
colesbury
left a comment
There was a problem hiding this comment.
A few comments below
Sorry, something went wrong.
There was a problem hiding this comment.
I would suggest isolating the loop in a separate function so that we do not have those weird labels jumps and confusing names but this should be benchmarked on PGO/LTO tocheck that we do not introduce an overhead (though I am not that worried as str.maketrans() is usually not a hot function).
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
d487864 to
05ba3f3
Compare
February 24, 2026 15:57
206f6b2 to
4e715b0
Compare
February 24, 2026 17:34
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
Sorry, something went wrong.
colesbury
left a comment
There was a problem hiding this comment.
LGTM, thanks
Sorry, something went wrong.
a249795
into
python:main
Feb 27, 2026
|
Thanks @VanshAgarwal24036 for the PR, and @colesbury for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
…gh-145157) (cherry picked from commit a249795) Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Replace unsafe PyDict_Next iteration with snapshot iteration using PyDict_Items to avoid crashes when the input dict is mutated concurrently under free-threading.
Adds a regression test.