diff -r 7530caa5ed1a Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Modules/_functoolsmodule.c Thu Apr 21 11:33:28 2016 +0300 @@ -549,7 +549,7 @@ functools_reduce(PyObject *self, PyObjec for (;;) { PyObject *op2; - if (args->ob_refcnt > 1) { + if (Py_REFCNT(args) > 1) { Py_DECREF(args); if ((args = PyTuple_New(2)) == NULL) goto Fail; diff -r 7530caa5ed1a Objects/dictobject.c --- a/Objects/dictobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/dictobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -3145,7 +3145,7 @@ static PyObject *dictiter_iternextitem(d if (i > mask) goto fail; - if (result->ob_refcnt == 1) { + if (Py_REFCNT(result) == 1) { Py_INCREF(result); Py_DECREF(PyTuple_GET_ITEM(result, 0)); Py_DECREF(PyTuple_GET_ITEM(result, 1)); diff -r 7530caa5ed1a Objects/enumobject.c --- a/Objects/enumobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/enumobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -102,7 +102,7 @@ enum_next_long(enumobject *en, PyObject* return NULL; en->en_longindex = stepped_up; - if (result->ob_refcnt == 1) { + if (Py_REFCNT(result) == 1) { Py_INCREF(result); Py_DECREF(PyTuple_GET_ITEM(result, 0)); Py_DECREF(PyTuple_GET_ITEM(result, 1)); @@ -141,7 +141,7 @@ enum_next(enumobject *en) } en->en_index++; - if (result->ob_refcnt == 1) { + if (Py_REFCNT(result) == 1) { Py_INCREF(result); Py_DECREF(PyTuple_GET_ITEM(result, 0)); Py_DECREF(PyTuple_GET_ITEM(result, 1)); diff -r 7530caa5ed1a Objects/fileobject.c --- a/Objects/fileobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/fileobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -94,7 +94,7 @@ PyFile_GetLine(PyObject *f, int n) "EOF when reading a line"); } else if (s[len-1] == '\n') { - if (result->ob_refcnt == 1) + if (Py_REFCNT(result) == 1) _PyBytes_Resize(&result, len-1); else { PyObject *v; diff -r 7530caa5ed1a Objects/object.c --- a/Objects/object.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/object.c Thu Apr 21 11:33:28 2016 +0300 @@ -27,10 +27,10 @@ Py_ssize_t hash table code is well-tested) */ o = _PyDict_Dummy(); if (o != NULL) - total -= o->ob_refcnt; + total -= Py_REFCNT(o); o = _PySet_Dummy; if (o != NULL) - total -= o->ob_refcnt; + total -= Py_REFCNT(o); return total; } @@ -215,7 +215,7 @@ void PyOS_snprintf(buf, sizeof(buf), "%s:%i object at %p has negative ref count " "%" PY_FORMAT_SIZE_T "d", - fname, lineno, op, op->ob_refcnt); + fname, lineno, op, Py_REFCNT(op)); Py_FatalError(buf); } @@ -449,7 +449,7 @@ void "refcount: %ld\n" "address : %p\n", Py_TYPE(op)==NULL ? "NULL" : Py_TYPE(op)->tp_name, - (long)op->ob_refcnt, + (long)Py_REFCNT(op), op); } } @@ -939,7 +939,7 @@ PyObject_SetAttr(PyObject *v, PyObject * return err; } Py_DECREF(name); - assert(name->ob_refcnt >= 1); + assert(Py_REFCNT(name) >= 1); if (tp->tp_getattr == NULL && tp->tp_getattro == NULL) PyErr_Format(PyExc_TypeError, "'%.100s' object has no attributes " @@ -1783,7 +1783,7 @@ void PyObject *op; fprintf(fp, "Remaining objects:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { - fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", op, op->ob_refcnt); + fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", op, Py_REFCNT(op)); if (PyObject_Print(op, fp, 0) != 0) PyErr_Clear(); putc('\n', fp); @@ -1800,7 +1800,7 @@ void fprintf(fp, "Remaining object addresses:\n"); for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", op, - op->ob_refcnt, Py_TYPE(op)->tp_name); + Py_REFCNT(op), Py_TYPE(op)->tp_name); } PyObject * @@ -1945,7 +1945,7 @@ void { assert(PyObject_IS_GC(op)); assert(_PyGC_REFS(op) == _PyGC_REFS_UNTRACKED); - assert(op->ob_refcnt == 0); + assert(Py_REFCNT(op) == 0); _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; _PyTrash_delete_later = op; } @@ -1957,7 +1957,7 @@ void PyThreadState *tstate = PyThreadState_GET(); assert(PyObject_IS_GC(op)); assert(_PyGC_REFS(op) == _PyGC_REFS_UNTRACKED); - assert(op->ob_refcnt == 0); + assert(Py_REFCNT(op) == 0); _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *) tstate->trash_delete_later; tstate->trash_delete_later = op; } @@ -1981,7 +1981,7 @@ void * assorted non-release builds calling Py_DECREF again ends * up distorting allocation statistics. */ - assert(op->ob_refcnt == 0); + assert(Py_REFCNT(op) == 0); ++_PyTrash_delete_nesting; (*dealloc)(op); --_PyTrash_delete_nesting; @@ -2006,7 +2006,7 @@ void * assorted non-release builds calling Py_DECREF again ends * up distorting allocation statistics. */ - assert(op->ob_refcnt == 0); + assert(Py_REFCNT(op) == 0); ++tstate->trash_delete_nesting; (*dealloc)(op); --tstate->trash_delete_nesting; diff -r 7530caa5ed1a Objects/tupleobject.c --- a/Objects/tupleobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/tupleobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -150,7 +150,7 @@ int PyTuple_SetItem(PyObject *op, Py_ssize_t i, PyObject *newitem) { PyObject **p; - if (!PyTuple_Check(op) || op->ob_refcnt != 1) { + if (!PyTuple_Check(op) || Py_REFCNT(op) != 1) { Py_XDECREF(newitem); PyErr_BadInternalCall(); return -1; diff -r 7530caa5ed1a Objects/typeobject.c --- a/Objects/typeobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/typeobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -1095,7 +1095,7 @@ subtype_dealloc(PyObject *self) } if (type->tp_del) { type->tp_del(self); - if (self->ob_refcnt > 0) + if (Py_REFCNT(self) > 0) return; } @@ -1163,7 +1163,7 @@ subtype_dealloc(PyObject *self) if (type->tp_del) { type->tp_del(self); - if (self->ob_refcnt > 0) { + if (Py_REFCNT(self) > 0) { /* Resurrected */ goto endlabel; } diff -r 7530caa5ed1a Objects/weakrefobject.c --- a/Objects/weakrefobject.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Objects/weakrefobject.c Thu Apr 21 11:33:28 2016 +0300 @@ -886,7 +886,7 @@ PyObject_ClearWeakRefs(PyObject *object) if (object == NULL || !PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)) - || object->ob_refcnt != 0) { + || Py_REFCNT(object) != 0) { PyErr_BadInternalCall(); return; } @@ -909,7 +909,7 @@ PyObject_ClearWeakRefs(PyObject *object) current->wr_callback = NULL; clear_weakref(current); if (callback != NULL) { - if (((PyObject *)current)->ob_refcnt > 0) + if (Py_REFCNT(current) > 0) handle_callback(current, callback); Py_DECREF(callback); } @@ -927,7 +927,7 @@ PyObject_ClearWeakRefs(PyObject *object) for (i = 0; i < count; ++i) { PyWeakReference *next = current->wr_next; - if (((PyObject *)current)->ob_refcnt > 0) + if (Py_REFCNT(current) > 0) { Py_INCREF(current); PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); diff -r 7530caa5ed1a Python/pyarena.c --- a/Python/pyarena.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Python/pyarena.c Thu Apr 21 11:33:28 2016 +0300 @@ -169,7 +169,7 @@ PyArena_Free(PyArena *arena) block_free(arena->a_head); /* This property normally holds, except when the code being compiled is sys.getobjects(0), in which case there will be two references. - assert(arena->a_objects->ob_refcnt == 1); + assert(Py_REFCNT(arena->a_objects) == 1); */ Py_DECREF(arena->a_objects); diff -r 7530caa5ed1a Python/sysmodule.c --- a/Python/sysmodule.c Wed Apr 20 10:02:04 2016 +0200 +++ b/Python/sysmodule.c Thu Apr 21 11:33:28 2016 +0300 @@ -1012,7 +1012,7 @@ Return the size of object in bytes."); static PyObject * sys_getrefcount(PyObject *self, PyObject *arg) { - return PyLong_FromSsize_t(arg->ob_refcnt); + return PyLong_FromSsize_t(Py_REFCNT(arg)); } #ifdef Py_REF_DEBUG