Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
gh-146041: Avoid lock in sys.intern() for already interned strings#146072
gh-146041: Avoid lock in sys.intern() for already interned strings#146072colesbury merged 4 commits intopython:mainfrom
Conversation
colesbury commentedMar 17, 2026
@encukou, please let me know if you'd like me to do this differently. I've removed the assertion about unicode state in |
mpage 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.
Looks correct to me
| PyObject *r; | ||
| int res = PyDict_GetItemRef(interned, s, &r); | ||
| if (res < 0) { | ||
| PyErr_Clear(); |
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.
Clearing the error here feels a little weird to me, but it's consistent with the rest of the function.
bedevere-bot commentedMar 24, 2026
🤖 New build scheduled with the buildbot fleet by@colesbury for commit6e59598 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146072%2Fmerge If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again. |
6009309 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry,@colesbury, I could not cleanly backport this to |
…ed strings (pythongh-146072)Fix free-threading scaling bottleneck in sys.intern and `PyObject_SetAttr` byavoiding the interpreter-wide lock when the string is already interned andimmortalized.(cherry picked from commit6009309)Co-authored-by: Sam Gross <colesbury@gmail.com>
GH-146390 is a backport of this pull request to the3.14 branch. |
Uh oh!
There was an error while loading.Please reload this page.
Fix free-threading scaling bottleneck in sys.intern and
PyObject_SetAttrby avoiding the interpreter-wide lock when the string is already interned and immortalized.sys.intern()#146041