summaryrefslogtreecommitdiff
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index c5812f827d..27db86a70b 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -3550,8 +3550,8 @@ slot_tp_del(PyObject *self)
PyObject *error_type, *error_value, *error_traceback;
/* Temporarily resurrect the object. */
- assert(self->ob_refcnt == 0);
- self->ob_refcnt = 1;
+ assert(Py_REFCNT(self) == 0);
+ Py_REFCNT(self) = 1;
/* Save the current exception, if any. */
PyErr_Fetch(&error_type, &error_value, &error_traceback);
@@ -3573,17 +3573,19 @@ slot_tp_del(PyObject *self)
/* Undo the temporary resurrection; can't use DECREF here, it would
* cause a recursive call.
*/
- assert(self->ob_refcnt > 0);
- if (--self->ob_refcnt == 0)
- return; /* this is the normal path out */
+ assert(Py_REFCNT(self) > 0);
+ if (--Py_REFCNT(self) == 0) {
+ /* this is the normal path out */
+ return;
+ }
/* __del__ resurrected it! Make it look like the original Py_DECREF
* never happened.
*/
{
- Py_ssize_t refcnt = self->ob_refcnt;
+ Py_ssize_t refcnt = Py_REFCNT(self);
_Py_NewReference(self);
- self->ob_refcnt = refcnt;
+ Py_REFCNT(self) = refcnt;
}
assert(!PyType_IS_GC(Py_TYPE(self)) || _PyObject_GC_IS_TRACKED(self));
/* If Py_REF_DEBUG macro is defined, _Py_NewReference() increased