Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b30738c

Browse files
committed
Add #ifdef to Py_NewRef()
1 parent 540c470 commit b30738c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pythoncapi_compat.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ extern "C" {
1313
#endif
1414

1515
#include <Python.h>
16-
#include "frameobject.h" // PyFrameObject
16+
#include "frameobject.h" // PyFrameObject, PyFrame_GetBack()
1717

18-
// bpo-42262 added Py_NewRef() and Py_XNewRef()
18+
19+
// bpo-42262 added Py_NewRef() and Py_XNewRef() to Python 3.10.0a3
20+
#if PY_VERSION_HEX < 0x030a00A3
1921
static inline PyObject* Py_NewRef(PyObject *obj)
2022
{
2123
Py_INCREF(obj);
@@ -27,6 +29,8 @@ static inline PyObject* Py_XNewRef(PyObject *obj)
2729
Py_XINCREF(obj);
2830
return obj;
2931
}
32+
#endif
33+
3034

3135
// bpo-39573: Py_TYPE(), Py_REFCNT() and Py_SIZE() can no longer be used
3236
// as l-value in Python 3.10.

0 commit comments

Comments
 (0)