Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-145142: Make str.maketrans safe under free-threading#145157
gh-145142: Make str.maketrans safe under free-threading#145157colesbury merged 13 commits intopython:mainfrom
Conversation
colesbury left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
A few comments below
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core_and_Builtins/2026-02-23-23-18-28.gh-issue-145142.T-XbVe.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
picnixz left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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 |
sharktide left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Bunch of syntax errors you need to fix as well.
I also agree with picnixz’s comments
d487864 to05ba3f3Compare206f6b2 to4e715b0CompareVanshAgarwal24036 commentedFeb 24, 2026
I have made the requested changes; please review again. |
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
colesbury left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, thanks
| } | ||
| static int | ||
| unicode_maketrans_from_dict(PyObject *x, PyObject *newdict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| unicode_maketrans_from_dict(PyObject*x,PyObject*newdict) | |
| unicode_maketrans_from_dict_lock_held(PyObject*x,PyObject*newdict) |
Naming convention for methods that require locking.
a249795 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@VanshAgarwal24036 for the PR, and@colesbury for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…gh-145157)(cherry picked from commita249795)Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
GH-145320 is a backport of this pull request to the3.14 branch. |
Uh oh!
There was an error while loading.Please reload this page.
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.