aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-12-03 14:01:10 +0100
committerGitHub <noreply@github.com>2020-12-03 14:01:10 +0100
commit8b6c4a921af6d5d0a9640211ac93d7886a55a8f3 (patch)
tree0c2af672c699e9d07e0da8780b4d87309b1dc3fc /Include
parentbpo-42553: Fix test_asyncio.test_call_later() (GH-23627) (diff)
downloadcpython-8b6c4a921af6d5d0a9640211ac93d7886a55a8f3.tar.gz
cpython-8b6c4a921af6d5d0a9640211ac93d7886a55a8f3.tar.bz2
cpython-8b6c4a921af6d5d0a9640211ac93d7886a55a8f3.zip
bpo-42262: Py_NewRef() casts its argument to PyObject* (GH-23626)
Write also unit tests on Py_NewRef() and Py_XNewRef().
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/Include/object.h b/Include/object.h
index f68423a09c4..8d0039428e7 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -426,7 +426,6 @@ static inline void _Py_INCREF(PyObject *op)
#endif
op->ob_refcnt++;
}
-
#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
static inline void _Py_DECREF(
@@ -449,7 +448,6 @@ static inline void _Py_DECREF(
_Py_Dealloc(op);
}
}
-
#ifdef Py_REF_DEBUG
# define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
#else
@@ -548,8 +546,8 @@ static inline PyObject* _Py_XNewRef(PyObject *obj)
// Py_NewRef() and Py_XNewRef() are exported as functions for the stable ABI.
// Names overriden with macros by static inline functions for best
// performances.
-#define Py_NewRef(obj) _Py_NewRef(obj)
-#define Py_XNewRef(obj) _Py_XNewRef(obj)
+#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj))
+#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj))
/*