mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Py_DECREF: only pass filename if Py_REF_DEBUG is defined (GH-17870)
Filename and line numbers are not needed when Py_REF_DEBUG are not
defined.
The static inline _Py_DECREF() function was introduced by
commit 2aaf0c1204.
This commit is contained in:
parent
5907e61a8d
commit
f3a0a6bbcc
1 changed files with 10 additions and 5 deletions
|
|
@ -461,11 +461,12 @@ static inline void _Py_INCREF(PyObject *op)
|
||||||
|
|
||||||
#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
|
#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
|
||||||
|
|
||||||
static inline void _Py_DECREF(const char *filename, int lineno,
|
static inline void _Py_DECREF(
|
||||||
PyObject *op)
|
#ifdef Py_REF_DEBUG
|
||||||
|
const char *filename, int lineno,
|
||||||
|
#endif
|
||||||
|
PyObject *op)
|
||||||
{
|
{
|
||||||
(void)filename; /* may be unused, shut up -Wunused-parameter */
|
|
||||||
(void)lineno; /* may be unused, shut up -Wunused-parameter */
|
|
||||||
_Py_DEC_REFTOTAL;
|
_Py_DEC_REFTOTAL;
|
||||||
if (--op->ob_refcnt != 0) {
|
if (--op->ob_refcnt != 0) {
|
||||||
#ifdef Py_REF_DEBUG
|
#ifdef Py_REF_DEBUG
|
||||||
|
|
@ -479,7 +480,11 @@ static inline void _Py_DECREF(const char *filename, int lineno,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
|
#ifdef Py_REF_DEBUG
|
||||||
|
# define Py_DECREF(op) _Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
|
||||||
|
#else
|
||||||
|
# define Py_DECREF(op) _Py_DECREF(_PyObject_CAST(op))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
|
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue