bpo-39573: Use Py_REFCNT() macro (GH-18388)

Replace direct acccess to PyObject.ob_refcnt with usage of the
Py_REFCNT() macro.
This commit is contained in:
Victor Stinner 2020-02-07 00:38:59 +01:00 committed by GitHub
parent 446463f8db
commit a93c51e3a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 42 additions and 38 deletions

View file

@ -1173,8 +1173,9 @@ subtype_dealloc(PyObject *self)
}
if (type->tp_del) {
type->tp_del(self);
if (self->ob_refcnt > 0)
if (Py_REFCNT(self) > 0) {
return;
}
}
/* Find the nearest base with a different tp_dealloc */
@ -1239,7 +1240,7 @@ subtype_dealloc(PyObject *self)
if (type->tp_del) {
_PyObject_GC_TRACK(self);
type->tp_del(self);
if (self->ob_refcnt > 0) {
if (Py_REFCNT(self) > 0) {
/* Resurrected */
goto endlabel;
}