FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-157710: Soft deprecate C API modifying str objects by vstinner · Pull Request #157711 · python/cpython · GitHub

Repository navigation

gh-157710: Soft deprecate C API modifying str objects - #157711

Merged
vstinner merged 8 commits into
python:mainfrom
vstinner:deprecate_unicode_capi
Oct 5, 2026
Merged

vstinner merged 8 commits into
python:mainfrom
vstinner:deprecate_unicode_capi

Conversation

vstinner commented Sep 17, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Soft deprecate PyUnicode_New(), PyUnicode_CopyCharacters(), PyUnicode_Fill(), PyUnicode_Resize(), PyUnicode_WRITE() and PyUnicode_WriteChar() functions. Use the PyUnicodeWriter API instead.

Soft deprecate PyUnicode_New(), PyUnicode_CopyCharacters(),
PyUnicode_Fill(), PyUnicode_Resize(), PyUnicode_WRITE() and
PyUnicode_WriteChar() functions. Use the PyUnicodeWriter API instead.

Mention also that PyUnicodeWriter is not thread safe.

Copy link
Copy Markdown
Member Author

read-the-docs-community Bot commented Sep 17, 2026 •
edited
Loading

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34934164 | 📁 Comparing 9d03d07 against main (5539c2a)

  🔍 Preview build  

51 files changed · + 1 added · ± 50 modified

+ Added

± Modified

encukou commented Sep 18, 2026

Copy link
Copy Markdown
Member

It looks like this should be a WG decision. I'd vote for it though.

Copy link
Copy Markdown
Member Author

@encukou:

It looks like this should be a WG decision. I'd vote for it though.

Ok. I created capi-workgroup/decisions#111 to get a decision from the C API Working Group. I added more details: list of PyPI affected project and mention that pythoncapi-compat provides the PyUnicodeWriter API on Python 3.6-3.13.

bedevere-app Bot added the type-feature A feature request or enhancement label Oct 2, 2026
test_capi.test_unicode:

* Add tests on PyUnicode_New() and PyUnicode_Resize(). Check that the
  result is either a mutable string, or the empty string singleton.
* Check that PyUnicode_Fill(), PyUnicode_CopyCharacters() and
  PyUnicode_WriteChar() fail to modify a string with 2 references.

Adjust documentation.
vstinner enabled auto-merge (squash) October 2, 2026 20:33

vstinner commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

The C API Working Group approved the soft deprecation: capi-workgroup/decisions#111 (comment).

Copy link
Copy Markdown
Member

@vstinner auto-merge is failing because this requires a PR review (since it's labelled type-feature), and there are conflicts. I'll disable it for now.

vstinner commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

@vstinner auto-merge is failing because this requires a PR review (since it's labelled type-feature), and there are conflicts. I'll disable it for now.

Ah right, there was a conflict. It's now solved.

@picnixz added "type-feature" on the issue, and the PR inherited the label. It means that another core dev should review the change?

picnixz commented Oct 4, 2026

Copy link
Copy Markdown
Member

Ah crap. I still think it's a feature but I don't think it needs a core dev approval... I don't like this new label stuff because this means we just can't make triaging better (I do appreciate when we know whether a change will be backported or not just by seeing the feature type).

picnixz removed the type-feature A feature request or enhancement label Oct 4, 2026

picnixz commented Oct 4, 2026

Copy link
Copy Markdown
Member

Would this work like that..?

picnixz commented Oct 4, 2026

Copy link
Copy Markdown
Member

Ok, I think we need to come up with a better reading of when something needs a type-feature really. It totally breaks my triaging.

Copy link
Copy Markdown
Member

Would this work like that..?

The bot will just re-add it I'm afraid, although it works to merge if you do it shortly after and don't touch the PR.

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think the easiest solution is to just approve the PR :)

I left a few grammar nitpicks below. The rest of this looks good to me.

Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Comment thread Doc/c-api/unicode.rst Outdated
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
bedevere-app Bot added the type-feature A feature request or enhancement label Oct 4, 2026
vstinner enabled auto-merge (squash) October 4, 2026 21:49
vstinner merged commit 84b0669 into python:main Oct 5, 2026
100 of 102 checks passed
vstinner deleted the deprecate_unicode_capi branch October 5, 2026 07:16

vstinner commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Merged. Thanks @ZeroIntensity for the review and fixes!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir type-feature A feature request or enhancement

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL