On 7 Jun 2021, at 05:05, Inada Naoki <songofacandy@gmail.com> wrote:

Hi, folks,

Since Python 3.8, PyArg_Parse*() APIs and Py_BuildValue() APIs emitted
DeprecationWarning when
'#' format is used without PY_SSIZE_T_CLEAN defined.
In Python 3.10, they raise a RuntimeError, not a warning. Extension
modules can not use '#' format with int.

So how about making PY_SSIZE_T_CLEAN not mandatory in Python 3.11?
Extension modules can use '#' format with ssize_t, without

Or should we wait one more version?

Its a bit late to complain (and I’m not affected by this myself), but those functions are part of the stable ABI. The change in 3.10 will break any extensions that use the stable ABI, use these functions and don’t use PY_SSIZE_T_CLEAN.  I have no idea how many of those exist, especially given that the stable ABI doesn’t seem to be used a lot. 

I guess this depends a little on what promises the stable ABI makes, the functions are still there but behave differently than before. 

P.S. I’d be in favour of just dropping PY_SSIZE_T_CLEAN completely (that is use Py_ssize_t unconditionally) to simplify the code base, apart from being slightly worried about the impact on the stable ABI. AFAIK The define was meant as a temporary transition mechanism when Py_ssize_t was introduced in the, by now, ancient past.


Twitter / micro.blog: @ronaldoussoren
Blog: https://blog.ronaldoussoren.net/