Uh oh!
There was an error while loading. Please reload this page.
gh-128863: Deprecate private C API functions - #128864
Conversation
37869e2 to
18f8581Compare* _PyBytes_Join() * _PyDict_GetItemStringWithError() * _PyDict_Pop() * _PyThreadState_UncheckedGet() * _PyUnicode_AsString() * _Py_HashPointer() * _Py_fopen_obj() Replace _Py_HashPointer() with Py_HashPointer(). Remove references to deprecated functions.
18f8581 to
8140437Comparevstinner
commented
Jan 15, 2025
encukou
commented
Jan 15, 2025
This is extra work for both you and for users. I do not see how this would reduce our maintenance burden. I also don't see any other benefit of this PR. |
Removing them from Python 3.16 seems a little hurried. Unless there is a specific reason to remove it sooner, how about schedule it for removal in Python 3.18? |
vstinner
commented
Jan 16, 2025
Code search on PyPI top 7,500 projects (2024-10-16). _PyBytes_Join(): 4 projects
_PyDict_GetItemStringWithError(): 3 projects
_PyDict_Pop(): 1 project
_PyThreadState_UncheckedGet(): 25 projects
_PyUnicode_AsString(): 1 project
_Py_HashPointer(): 3 projects
_Py_fopen_obj(): 1 project
I ignored projects including copies of these dependencies such as pybind11 copies. Total: 33 projects Affected projects (33):
|
vstinner
commented
Jan 16, 2025
I'm fine with using a longer deprecation period for Other functions are used by less than 5 projects and so can use a faster deprecation period, no? |
methane
commented
Jan 16, 2025
Python 3.13 will reach EOL in 2029. I want to keep it until 2031 (2029+2).
Python 3.12 will reach EOL in 2028. I want to keep it until 2030 (2028+2). Removing _PyUnicode_AsString with minimum deprecation period is OK because PyUnicode_AsUTF8 is added in 3.3. |
vstinner
commented
Jan 19, 2025
I updated my PR to postpone the removal to Python 3.18. |
vstinner
commented
Jan 19, 2025
serhiy-storchaka
left a comment
There was a problem hiding this comment.
I am not sure that it is worth to go such far in preserving compatibility for private C API. Usually we just changed it at will, it was a fair play.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Jan 21, 2025
Do you suggest to remove these functions earlier? |
serhiy-storchaka
commented
Jan 22, 2025
Were not some of them already removed? This is only my grumbling. I would remove them without warning if there is a replacement. You have to ask other core developers if they have reasons to keep the old private C API. Removing a private C API is not the worst thing that can be happen if you use private C API. It can change semantic -- start returning a strong reference instead of a weak reference or vice versa, start stealing a reference, change the order of parameters, etc. But if keep them -- your PR LGTM. |
vstinner
commented
Jan 22, 2025
Merged, thanks for review. |
Replace _Py_HashPointer() with Py_HashPointer().
Remove references to deprecated functions.
📚 Documentation preview 📚: https://cpython-previews--128864.org.readthedocs.build/