encukou / abi3

Improvements of Python's stable ABI
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Allow deprecating stable functions/features #9

Open encukou opened 3 years ago

encukou commented 3 years ago

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).

encukou commented 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 :)

vstinner commented 3 years ago

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 */
}
encukou commented 3 years ago

That is an example of a function I'd not want to remove in abi3. Keeping it doesn't hurt anyone.

encukou commented 2 years ago

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):

encukou commented 2 years ago

Static types are another candidate: https://bugs.python.org/issue40601

encukou commented 1 year ago

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