mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.13] gh-140487: Fix Py_RETURN_NOTIMPLEMENTED in limited C API 3.11 (GH-140636) (GH-140670)
Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE have already been fixed by commit9258f3da91(issue gh-134989). (cherry picked from commitc636477523)
This commit is contained in:
parent
0e3b47b839
commit
ec5f5418f9
2 changed files with 9 additions and 2 deletions
|
|
@ -1130,8 +1130,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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Fix :c:macro:`Py_RETURN_NOTIMPLEMENTED` in limited C API 3.11 and older:
|
||||
don't treat ``Py_NotImplemented`` as immortal. Patch by Victor Stinner.
|
||||
Loading…
Add table
Add a link
Reference in a new issue