summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-03-08 19:03:50 (GMT)
committerGitHub <noreply@github.com>2023-03-08 19:03:50 (GMT)
commitcbb0aa71d040022db61390380b8aebc7c04f3275 (patch)
tree9ff9e2f3141fbd5bdc2446144955722a7d63afa9 /Objects/dictobject.c
parent11a2c6ce516b24b2435cb627742a6c4df92d411c (diff)
downloadcpython-cbb0aa71d040022db61390380b8aebc7c04f3275.zip
cpython-cbb0aa71d040022db61390380b8aebc7c04f3275.tar.gz
cpython-cbb0aa71d040022db61390380b8aebc7c04f3275.tar.bz2
gh-102304: Consolidate Direct Usage of _Py_RefTotal (gh-102514)
This simplifies further changes to _Py_RefTotal (e.g. make it atomic or move it to PyInterpreterState). https://github.com/python/cpython/issues/102304
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 75c9217..a60f275 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -303,7 +303,7 @@ static inline void
dictkeys_incref(PyDictKeysObject *dk)
{
#ifdef Py_REF_DEBUG
- _Py_RefTotal++;
+ _Py_IncRefTotal();
#endif
dk->dk_refcnt++;
}
@@ -313,7 +313,7 @@ dictkeys_decref(PyDictKeysObject *dk)
{
assert(dk->dk_refcnt > 0);
#ifdef Py_REF_DEBUG
- _Py_RefTotal--;
+ _Py_DecRefTotal();
#endif
if (--dk->dk_refcnt == 0) {
free_keys_object(dk);
@@ -633,7 +633,7 @@ new_keys_object(uint8_t log2_size, bool unicode)
}
}
#ifdef Py_REF_DEBUG
- _Py_RefTotal++;
+ _Py_IncRefTotal();
#endif
dk->dk_refcnt = 1;
dk->dk_log2_size = log2_size;
@@ -821,7 +821,7 @@ clone_combined_dict_keys(PyDictObject *orig)
we have it now; calling dictkeys_incref would be an error as
keys->dk_refcnt is already set to 1 (after memcpy). */
#ifdef Py_REF_DEBUG
- _Py_RefTotal++;
+ _Py_IncRefTotal();
#endif
return keys;
}
@@ -1520,7 +1520,7 @@ dictresize(PyDictObject *mp, uint8_t log2_newsize, int unicode)
// We can not use free_keys_object here because key's reference
// are moved already.
#ifdef Py_REF_DEBUG
- _Py_RefTotal--;
+ _Py_DecRefTotal();
#endif
if (oldkeys == Py_EMPTY_KEYS) {
oldkeys->dk_refcnt--;