File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ extern "C" {
1919#include "frameobject.h" // PyFrameObject, PyFrame_GetBack()
2020
2121
22+ // Cast argument to PyObject* type.
23+ #ifndef _PyObject_CAST
24+ # define _PyObject_CAST (op ) ((PyObject*)(op))
25+ #endif
26+
27+
2228// bpo-42262 added Py_NewRef() and Py_XNewRef() to Python 3.10.0a3
2329#if PY_VERSION_HEX < 0x030a00A3
2430static inline PyObject * Py_NewRef (PyObject * obj )
@@ -36,17 +42,19 @@ static inline PyObject* Py_XNewRef(PyObject *obj)
3642
3743
3844// bpo-42522
39- static inline PyObject * _Py_Borrow (PyObject * obj )
45+ static inline PyObject * __Py_Borrow (PyObject * obj )
4046{
4147 Py_DECREF (obj );
4248 return obj ;
4349}
50+ #define _Py_Borrow (obj ) __Py_Borrow(_PyObject_CAST(obj))
4451
45- static inline PyObject * _Py_XBorrow (PyObject * obj )
52+ static inline PyObject * __Py_XBorrow (PyObject * obj )
4653{
4754 Py_XDECREF (obj );
4855 return obj ;
4956}
57+ #define _Py_XBorrow (obj ) __Py_XBorrow(_PyObject_CAST(obj))
5058
5159
5260// bpo-39573: Py_TYPE(), Py_REFCNT() and Py_SIZE() can no longer be used
You can’t perform that action at this time.
0 commit comments