Uh oh!
There was an error while loading. Please reload this page.
gh-128863: Deprecate the private _PyUnicodeWriter API - #129245
Conversation
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.
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.
I do not see the benefit of removing these.
Uh oh!
There was an error while loading. Please reload this page.
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.
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/