New submission from STINNER Victor <>:

I propose to change PyVectorcall_NARGS() return type from unsigned size_t to 
signed Py_ssize_t.

Currently, the function is defined as:

static inline Py_ssize_t
PyVectorcall_NARGS(size_t n)

But in CPython code base, the result is always stored in a *signed* Py_ssize_t:

    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);

Sometimes, this nargs is passed to _PyObject_MakeTpCall() which expects nargs 
to be Py_ssize_t, so it's consistent.

In general in CPython, a size uses type Py_ssize_t, not size_t. Example: 
PyVarObject.ob_size type is Py_ssize_t.

components: C API
messages: 361824
nosy: jdemeyer, petr.viktorin, vstinner
priority: normal
severity: normal
status: open
title: PyVectorcall_NARGS(): change return type to Py_ssize_t
versions: Python 3.9

Python tracker <>
Python-bugs-list mailing list

Reply via email to