Open encukou opened 3 years ago
@vstinner, it seems you're interested in deprecating in the Limited API / Stable ABI. Do you have a list of what you'd like to deprecated? Or just one thing you'd like to be gone? It would be nice to do this with a relevant example :)
In a perfect world, I would like to remove almost all functions of the Python C API :-) Only 2 or 3 functions should be enough for everyone :-D
In the meanwhile, I would like to remove PyEval_InitThreads(). Deprecated in 3.9, PyEval_InitThreads() now does nothing. See https://bugs.python.org/issue44117 and https://github.com/python/cpython/pull/26070
In Python main branch:
void
PyEval_InitThreads(void)
{
/* Do nothing: kept for backward compatibility */
}
That is an example of a function I'd not want to remove in abi3
. Keeping it doesn't hurt anyone.
A candidate for removal is the old buffer protocol (see https://bugs.python.org/issue41103), but only after the new API is available in Limited ABI (https://bugs.python.org/issue45459):
PyObject_AsCharBuffer
PyObject_AsReadBuffer
PyObject_AsWriteBuffer
PyObject_CheckReadBuffer
Static types are another candidate: https://bugs.python.org/issue40601
PySlice_GetIndices
/PySlice_GetIndicesEx
are another candidate: https://discuss.python.org/t/is-pyslice-getindices-still-used/20778
PySequence_Fast
is another candidate: https://github.com/python/cpython/issues/91417
And more: Py_TPFLAGS_HAVE_FINALIZE
, Py_TPFLAGS_HAVE_VERSION_TAG
, PY_TIMEOUT_MAX
, anything marked abi-only
Old functions would need to be available forever, but they could be deprecated at build time. Maybe they could even be removed for newer
Py_LIMITED_API
(but still be available at run time).