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

@ -2494,8 +2494,8 @@ Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
[clinic start generated code]*/
static PyObject *
bytes_fromhex(PyTypeObject *type, PyObject *string)
/*[clinic end generated code: output=d458ec88195da6b3 input=f37d98ed51088a21]*/
bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
/*[clinic end generated code: output=0973acc63661bb2e input=f37d98ed51088a21]*/
{
PyObject *result = _PyBytes_FromHex(string, 0);
if (type != &PyBytes_Type && result != NULL) {