Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-128863: Deprecate the private _PyUnicodeWriter API#129245
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 our terms of service and privacy 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
vstinner commented Jan 23, 2025 • edited by github-actions bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by github-actions bot
Uh oh!
There was an error while loading. Please reload this page.
Deprecate private C API functions: * _PyUnicodeWriter_Init() * _PyUnicodeWriter_Finish() * _PyUnicodeWriter_Dealloc() * _PyUnicodeWriter_WriteChar() * _PyUnicodeWriter_WriteStr() * _PyUnicodeWriter_WriteSubstring() * _PyUnicodeWriter_WriteASCIIString() * _PyUnicodeWriter_WriteLatin1String() These functions are not deprecated in the internal C API (if the Py_BUILD_CORE macro is defined).
vstinner commented Jan 23, 2025
vstinner commented Jan 24, 2025
serhiy-storchaka 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.
I expected a large PR that replaces the _PyUnicodeWriter API with the PyUnicodeWriter API.
vstinner commented Jan 24, 2025
I wrote a serie of changes to use the public C API in issue gh-119182:
|
vstinner commented Jan 27, 2025
@encukou: The replacement functions are straightforward, except for _PyUnicodeWriter_Init() which requires to pass an argument to PyUnicodeWriter_Create(). I documented the replacement as |
encukou 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.
I do not see the benefit of removing these.
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/C_API/2025-01-15-11-42-07.gh-issue-128863.C9MkB_.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
When you're done making the requested changes, leave the comment: |
vstinner commented Jan 28, 2025
The private The private API has no documentation and is not tested. Removing it reduces the size of the C API. It's also a way to promote the public C API which doesn't expose PEP 393 internals. |
Uh oh!
There was an error while loading. Please reload this page.
encukou commented Jan 28, 2025
Do you think it'd be a good idea to mention the reasons in the porting notes? If people see the reason, maybe the issues they file will be less angry.
If that's the reason, is planning to remove them in 3.18 a good idea? |
vstinner commented Jan 29, 2025
We don't document rationale for deprecations in the documentation. I don't think that it's worth it.
Changing |
encukou commented Jan 29, 2025
Why can't the deprecation/removal also wait? |
vstinner commented Jan 30, 2025
If the function is never deprecated, it will only postpone when the private C API can be modified/enhanced. |
erlend-aasland commented Feb 2, 2025
It's a deprecation, not a removal. |
encukou commented Feb 4, 2025
This PR schedules a removal for 3.18. |
vstinner commented Feb 5, 2025
I created a C API Working Group decision issue for this change: capi-workgroup/decisions#57 |
vstinner commented Feb 19, 2025
The working group decided to deprecate the API and remove it in Python 3.18. |
Petr wrote "Count me as -0 so I don't block the work" on the working group issue.
519c2c6 into python:mainUh oh!
There was an error while loading. Please reload this page.
Deprecate private C API functions:
These functions are not deprecated in the internal C API (if the Py_BUILD_CORE macro is defined).
📚 Documentation preview 📚: https://cpython-previews--129245.org.readthedocs.build/