Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193) #107199

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,8 @@ you can count such references to the type object.)
#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
PyObject *op);
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
# define _Py_DEC_REFTOTAL() _Py_DecRefTotal_DO_NOT_USE_THIS()
PyAPI_FUNC(void) _Py_INCREF_IncRefTotal(void);
PyAPI_FUNC(void) _Py_DECREF_DecRefTotal(void);
#endif // Py_REF_DEBUG && !Py_LIMITED_API

PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
Expand Down Expand Up @@ -640,7 +638,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
#endif
_Py_INCREF_STAT_INC();
#ifdef Py_REF_DEBUG
_Py_INC_REFTOTAL();
_Py_INCREF_IncRefTotal();
#endif
#endif
}
Expand Down Expand Up @@ -669,7 +667,7 @@ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op)
return;
}
_Py_DECREF_STAT_INC();
_Py_DEC_REFTOTAL();
_Py_DECREF_DecRefTotal();
if (--op->ob_refcnt != 0) {
if (op->ob_refcnt < 0) {
_Py_NegativeRefcount(filename, lineno, op);
Expand Down Expand Up @@ -697,9 +695,6 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
#define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
#endif

#undef _Py_INC_REFTOTAL
#undef _Py_DEC_REFTOTAL


/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
* and tp_dealloc implementations.
Expand Down
4 changes: 2 additions & 2 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ _Py_NegativeRefcount(const char *filename, int lineno, PyObject *op)

/* This is used strictly by Py_INCREF(). */
void
_Py_IncRefTotal_DO_NOT_USE_THIS(void)
_Py_INCREF_IncRefTotal(void)
{
reftotal_increment(_PyInterpreterState_GET());
}

/* This is used strictly by Py_DECREF(). */
void
_Py_DecRefTotal_DO_NOT_USE_THIS(void)
_Py_DECREF_DecRefTotal(void)
{
reftotal_decrement(_PyInterpreterState_GET());
}
Expand Down