gh-111178: Change Argument Clinic signature for @classmethod (#131157)

Use "PyObject*", instead of "PyTypeObject*", for `@classmethod`
functions to fix an undefined behavior.
This commit is contained in:
Victor Stinner 2025-03-12 17:42:07 +01:00 committed by GitHub
parent de2f7da77d
commit 061da44bac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 164 additions and 62 deletions

View file

@ -1273,8 +1273,8 @@ Create a floating-point number from a hexadecimal string.
[clinic start generated code]*/
static PyObject *
float_fromhex(PyTypeObject *type, PyObject *string)
/*[clinic end generated code: output=46c0274d22b78e82 input=0407bebd354bca89]*/
float_fromhex_impl(PyTypeObject *type, PyObject *string)
/*[clinic end generated code: output=c54b4923552e5af5 input=0407bebd354bca89]*/
{
PyObject *result;
double x;
@ -1687,8 +1687,8 @@ Convert real number to a floating-point number.
[clinic start generated code]*/
static PyObject *
float_from_number(PyTypeObject *type, PyObject *number)
/*[clinic end generated code: output=bbcf05529fe907a3 input=1f8424d9bc11866a]*/
float_from_number_impl(PyTypeObject *type, PyObject *number)
/*[clinic end generated code: output=dda7e4466ab7068d input=1f8424d9bc11866a]*/
{
if (PyFloat_CheckExact(number) && type == &PyFloat_Type) {
Py_INCREF(number);