8000 [3.12] gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193… · python/cpython@3923639 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3923639

Browse files
[3.12] gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193) (#107199)
gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193) * Rename _Py_IncRefTotal_DO_NOT_USE_THIS() to _Py_INCREF_IncRefTotal() * Rename _Py_DecRefTotal_DO_NOT_USE_THIS() to _Py_DECREF_DecRefTotal() * Remove temporary _Py_INC_REFTOTAL() and _Py_DEC_REFTOTAL() macros (cherry picked from commit 8ebc9fc) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 5bf7165 commit 3923639

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

Include/object.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,8 @@ you can count such references to the type object.)
588588
#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
589589
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
590590
PyObject *op);
591-
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
592-
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
593-
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
594-
# define _Py_DEC_REFTOTAL() _Py_DecRefTotal_DO_NOT_USE_THIS()
591+
PyAPI_FUNC(void) _Py_INCREF_IncRefTotal(void);
592+
PyAPI_FUNC(void) _Py_DECREF_DecRefTotal(void);
595593
#endif // Py_REF_DEBUG && !Py_LIMITED_API
596594

597595
PyAPI_FUNC(void) _Py_Deallo 10000 c(PyObject *);
@@ -640,7 +638,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
640638
#endif
641639
_Py_INCREF_STAT_INC();
642640
#ifdef Py_REF_DEBUG
643-
_Py_INC_REFTOTAL();
641+
_Py_INCREF_IncRefTotal();
644642
#endif
645643
#endif
646644
}
@@ -669,7 +667,7 @@ static inline void Py_DECREF(const char *filename, int lineno, PyObject *op)
669667
return;
670668
}
671669
_Py_DECREF_STAT_INC();
672-
_Py_DEC_REFTOTAL();
670+
_Py_DECREF_DecRefTotal();
673671
if (--op->ob_refcnt != 0) {
674672
if (op->ob_refcnt < 0) {
675673
_Py_NegativeRefcount(filename, lineno, op);
@@ -697,9 +695,6 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
697695
#define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
698696
#endif
699697

700-
#undef _Py_INC_REFTOTAL
701-
#undef _Py_DEC_REFTOTAL
702-
703698

704699
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
705700
* and tp_dealloc implementations.

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ _Py_NegativeRefcount(const char *filename, int lineno, PyObject *op)
206206

207207
/* This is used strictly by Py_INCREF(). */
208208
void
209-
_Py_IncRefTotal_DO_NOT_USE_THIS(void)
209+
_Py_INCREF_IncRefTotal(void)
210210
{
211211
reftotal_increment(_PyInterpreterState_GET());
212212
}
213213

214214
/* This is used strictly by Py_DECREF(). */
215215
void
216-
_Py_DecRefTotal_DO_NOT_USE_THIS(void)
216+
_Py_DECREF_DecRefTotal(void)
217217
{
218218
reftotal_decrement(_PyInterpreterState_GET());
219219
}

0 commit comments

Comments
 (0)
0