New submission from STINNER Victor <vstin...@python.org>:
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) { return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET; } 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 <rep...@bugs.python.org> <https://bugs.python.org/issue39611> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com