diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-05 00:11:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 00:11:10 (GMT) |
commit | 40e547dfbb9052ca0c667b242f6825ed1c23c195 (patch) | |
tree | aebb9f8925156ed5a97bbd0daddb43e4c03e2839 /Include/object.h | |
parent | 2545fa87628b4caca519da8aeb0eeef368b9dc0d (diff) | |
download | cpython-40e547dfbb9052ca0c667b242f6825ed1c23c195.zip cpython-40e547dfbb9052ca0c667b242f6825ed1c23c195.tar.gz cpython-40e547dfbb9052ca0c667b242f6825ed1c23c195.tar.bz2 |
bpo-39542: Make _Py_NewReference() opaque in C API (GH-18346)
_Py_NewReference() becomes a regular opaque function, rather than a
static inline function in the C API (object.h), to better hide
implementation details.
Move _Py_tracemalloc_config from public pymem.h to internal
pycore_pymem.h header.
Make _Py_AddToAllObjects() private.
Diffstat (limited to 'Include/object.h')
-rw-r--r-- | Include/object.h | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/Include/object.h b/Include/object.h index 175a208..8dccbf1 100644 --- a/Include/object.h +++ b/Include/object.h @@ -1,8 +1,6 @@ #ifndef Py_OBJECT_H #define Py_OBJECT_H -#include "pymem.h" /* _Py_tracemalloc_config */ - #ifdef __cplusplus extern "C" { #endif @@ -390,28 +388,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); when a memory block is reused from a free list. */ PyAPI_FUNC(int) _PyTraceMalloc_NewReference(PyObject *op); +PyAPI_FUNC(void) _Py_NewReference(PyObject *op); + #ifdef Py_TRACE_REFS /* Py_TRACE_REFS is such major surgery that we call external routines. */ PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); -PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); #endif - -static inline void _Py_NewReference(PyObject *op) -{ - if (_Py_tracemalloc_config.tracing) { - _PyTraceMalloc_NewReference(op); - } -#ifdef Py_REF_DEBUG - _Py_RefTotal++; -#endif - Py_REFCNT(op) = 1; -#ifdef Py_TRACE_REFS - _Py_AddToAllObjects(op, 1); -#endif -} - - PyAPI_FUNC(void) _Py_Dealloc(PyObject *); static inline void _Py_INCREF(PyObject *op) |