Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
corona10 merged 4 commits intopython:mainfromcorona10:kumar-test
Apr 29, 2025

Conversation

corona10
Copy link
Member

@corona10corona10 commentedApr 27, 2025
edited by bedevere-appbot
Loading

@corona10corona10 changed the titleKumar testgh-132070: use _PyObject_IsUniquelyReferenced in unicodeobjectApr 27, 2025
@corona10
Copy link
MemberAuthor

corona10 commentedApr 27, 2025
edited
Loading

@kumaraditya303@colesbury
I continued working on Kumar's PR#132091. In the new change, more states of unicode_modifiable are observed in free-threading builds. So I added a fallback to use resize_copy when unicode_modifiable fails, but I'm not sure if this is the right approach.
But the test failure issues are resolved.

@corona10corona10 marked this pull request as ready for reviewApril 27, 2025 10:12
@corona10corona10 changed the titlegh-132070: use _PyObject_IsUniquelyReferenced in unicodeobjectgh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobjectApr 27, 2025
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

Copy link
Contributor

@colesburycolesbury left a 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().

@corona10corona10 merged commit75cbb8d intopython:mainApr 29, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks@corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestApr 29, 2025
…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>
@bedevere-app
Copy link

GH-133121 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelApr 29, 2025
@corona10corona10 deleted the kumar-test branchApril 29, 2025 02:07
@bedevere-app
Copy link

GH-133126 is a backport of this pull request to the3.13 branch.

corona10 added a commit that referenced this pull requestApr 29, 2025
…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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@colesburycolesburycolesbury approved these changes

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@kumaraditya303kumaraditya303Awaiting requested review from kumaraditya303

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@corona10@colesbury@serhiy-storchaka@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp