gh-140487: Fix Py_RETURN_NOTIMPLEMENTED in limited C API 3.11 (GH-140636)

Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE have already been
fixed by commit 9258f3da91 (issue gh-134989).
This commit is contained in:
Victor Stinner 2025-10-27 12:59:56 +01:00 committed by GitHub
parent 18e4a89e42
commit c636477523
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -695,8 +695,13 @@ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
# define Py_NotImplemented (&_Py_NotImplementedStruct)
#endif
/* Macro for returning Py_NotImplemented from a function */
#define Py_RETURN_NOTIMPLEMENTED return Py_NotImplemented
/* Macro for returning Py_NotImplemented from a function. Only treat
* Py_NotImplemented as immortal in the limited C API 3.12 and newer. */
#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030c0000
# define Py_RETURN_NOTIMPLEMENTED return Py_NewRef(Py_NotImplemented)
#else
# define Py_RETURN_NOTIMPLEMENTED return Py_NotImplemented
#endif
/* Rich comparison opcodes */
#define Py_LT 0