mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-39542: Make PyObject_INIT() opaque in limited C API (GH-18363)
In the limited C API, PyObject_INIT() and PyObject_INIT_VAR() are now defined as aliases to PyObject_Init() and PyObject_InitVar() to make their implementation opaque. It avoids to leak implementation details in the limited C API. Exclude the following functions from the limited C API, move them from object.h to cpython/object.h: * _Py_NewReference() * _Py_ForgetReference() * _PyTraceMalloc_NewReference() * _Py_GetRefTotal()
This commit is contained in:
parent
0fa4f43db0
commit
f58bd7c169
6 changed files with 79 additions and 51 deletions
|
@ -233,8 +233,7 @@ PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
|
|||
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
|
||||
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
|
||||
PyObject *, PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *);
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
||||
PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *);
|
||||
#endif
|
||||
|
@ -381,20 +380,8 @@ you can count such references to the type object.)
|
|||
PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
|
||||
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
|
||||
PyObject *op);
|
||||
PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
|
||||
#endif /* Py_REF_DEBUG */
|
||||
|
||||
/* Update the Python traceback of an object. This function must be called
|
||||
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 *);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
|
||||
|
||||
static inline void _Py_INCREF(PyObject *op)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue