gh-128863: Deprecate the private _PyUnicodeWriter API#129245
gh-128863: Deprecate the private _PyUnicodeWriter API#129245vstinner merged 11 commits intopython:mainfrom
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).
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.
I wrote a serie of changes to use the public C API in issue gh-119182:
|
|
@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.
Misc/NEWS.d/next/C_API/2025-01-15-11-42-07.gh-issue-128863.C9MkB_.rst
Outdated
Show resolved
Hide resolved
|
When you're done making the requested changes, leave the comment: |
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. |
|
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? |
We don't document rationale for deprecations in the documentation. I don't think that it's worth it.
Changing |
Why can't the deprecation/removal also wait? |
If the function is never deprecated, it will only postpone when the private C API can be modified/enhanced. |
It's a deprecation, not a removal. |
This PR schedules a removal for 3.18. |
|
I created a C API Working Group decision issue for this change: capi-workgroup/decisions#57 |
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/