Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject#133039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
corona10 commentedApr 27, 2025 • 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.
@kumaraditya303@colesbury |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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.
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 looked into the case that requiresresize_copy
: We have anio.StringIO
, which is used first by one thread and then by a second thread. (It's not used by two threads simultaneously). Theio.StringIO
has the only reference to aPyUnicodeWriter
, which in turn has the only reference to unicode object that is treated as a buffer.
The_PyObject_IsUniquelyReferenced()
check is too conservative in this case because the unicode object is owned by a different thread. The unicode object is actually safe to modify, we just can't tell that from_PyObject_IsUniquelyReferenced()
.
75cbb8d
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…ythongh-133039)---------(cherry picked from commit75cbb8d)Co-authored-by: Donghee Na <donghee.na@python.org>Co-authored-by: Kumar Aditya <kumaraditya@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-133121 is a backport of this pull request to the3.13 branch. |
GH-133126 is a backport of this pull request to the3.13 branch. |
…gh-133039) (gh-133126)*gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039)---------(cherry picked from commit75cbb8d)Co-authored-by: Donghee Na <donghee.na@python.org>Co-authored-by: Kumar Aditya <kumaraditya@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>* Add _PyObject_IsUniquelyReferenced---------Co-authored-by: Kumar Aditya <kumaraditya@python.org>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.