Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec5f541

Browse files
authored
[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 beenfixed by commit9258f3d (issuegh-134989).(cherry picked from commitc636477)
1 parent0e3b47b commitec5f541

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎Include/object.h‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,13 @@ PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */
11301130
# definePy_NotImplemented (&_Py_NotImplementedStruct)
11311131
#endif
11321132

1133-
/* Macro for returning Py_NotImplemented from a function */
1134-
#definePy_RETURN_NOTIMPLEMENTED return Py_NotImplemented
1133+
/* Macro for returning Py_NotImplemented from a function. Only treat
1134+
* Py_NotImplemented as immortal in the limited C API 3.12 and newer. */
1135+
#if defined(Py_LIMITED_API)&&Py_LIMITED_API+0<0x030c0000
1136+
# definePy_RETURN_NOTIMPLEMENTED return Py_NewRef(Py_NotImplemented)
1137+
#else
1138+
# definePy_RETURN_NOTIMPLEMENTED return Py_NotImplemented
1139+
#endif
11351140

11361141
/* Rich comparison opcodes */
11371142
#definePy_LT 0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix:c:macro:`Py_RETURN_NOTIMPLEMENTED` in limited C API 3.11 and older:
2+
don't treat ``Py_NotImplemented`` as immortal. Patch by Victor Stinner.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp