diff options
-rw-r--r-- | Include/bytesobject.h | 2 | ||||
-rw-r--r-- | Include/stringobject.h | 2 | ||||
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 2 | ||||
-rw-r--r-- | Modules/arraymodule.c | 4 | ||||
-rw-r--r-- | Modules/datetimemodule.c | 12 | ||||
-rw-r--r-- | Objects/bytesobject.c | 12 | ||||
-rw-r--r-- | Objects/setobject.c | 8 | ||||
-rw-r--r-- | Objects/stringobject.c | 2 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 8 |
9 files changed, 26 insertions, 26 deletions
diff --git a/Include/bytesobject.h b/Include/bytesobject.h index a649d39c02..f1e01d16f9 100644 --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -42,7 +42,7 @@ PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t); /* Macros, trading safety for speed */ #define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes) -#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size) +#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_Size(self)) #ifdef __cplusplus } diff --git a/Include/stringobject.h b/Include/stringobject.h index 1d932ff54b..c6ae1a81e0 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -85,7 +85,7 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Macro, trading safety for speed */ #define PyString_AS_STRING(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_sval)) -#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_size)) +#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_Size(op)) /* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index e1b03a0148..e6db969770 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4041,7 +4041,7 @@ Simple_repr(CDataObject *self) if (val == NULL) return NULL; - name = PyUnicode_FromString(self->ob_type->tp_name); + name = PyUnicode_FromString(Py_Type(self)->tp_name); if (name == NULL) { Py_DECREF(val); return NULL; diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 89e3f25f4e..36fec5327f 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1235,7 +1235,7 @@ array. Also called as read."); static PyObject * array_tofile(arrayobject *self, PyObject *f) { - Py_ssize_t nbytes = self->ob_size * self->ob_descr->itemsize; + Py_ssize_t nbytes = Py_Size(self) * self->ob_descr->itemsize; /* Write 64K blocks at a time */ /* XXX Make the block size settable */ int BLOCKSIZE = 64*1024; @@ -1383,7 +1383,7 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { return PyBytes_FromStringAndSize(self->ob_item, - self->ob_size * self->ob_descr->itemsize); + Py_Size(self) * self->ob_descr->itemsize); } PyDoc_STRVAR(tostring_doc, diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 5b2893d330..61bba86b02 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -950,7 +950,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg) if (!PyString_Check(result) && !PyUnicode_Check(result)) { PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " "return None or a string, not '%s'", - result->ob_type->tp_name); + Py_Type(result)->tp_name); Py_DECREF(result); result = NULL; } @@ -1969,18 +1969,18 @@ delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) return PyUnicode_FromFormat("%s(%d, %d, %d)", - self->ob_type->tp_name, + Py_Type(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) return PyUnicode_FromFormat("%s(%d, %d)", - self->ob_type->tp_name, + Py_Type(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); return PyUnicode_FromFormat("%s(%d)", - self->ob_type->tp_name, + Py_Type(self)->tp_name, GET_TD_DAYS(self)); } @@ -2381,7 +2381,7 @@ static PyObject * date_repr(PyDateTime_Date *self) { return PyUnicode_FromFormat("%s(%d, %d, %d)", - self->ob_type->tp_name, + Py_Type(self)->tp_name, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); } @@ -2557,7 +2557,7 @@ date_getstate(PyDateTime_Date *self, int hashable) static PyObject * date_reduce(PyDateTime_Date *self, PyObject *arg) { - return Py_BuildValue("(ON)", self->ob_type, date_getstate(self, 0)); + return Py_BuildValue("(ON)", Py_Type(self), date_getstate(self, 0)); } static PyMethodDef date_methods[] = { diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 31db95fbee..25f77634db 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -102,7 +102,7 @@ PyBytes_FromStringAndSize(const char *bytes, Py_ssize_t size) memcpy(new->ob_bytes, bytes, size); new->ob_bytes[size] = '\0'; /* Trailing null byte */ } - new->ob_size = size; + Py_Size(new) = size; new->ob_alloc = alloc; return (PyObject *)new; @@ -232,7 +232,7 @@ bytes_iconcat(PyBytesObject *self, PyObject *other) return PyErr_NoMemory(); if (size < self->ob_alloc) { Py_Size(self) = size; - self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ + self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */ } else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; @@ -281,7 +281,7 @@ bytes_irepeat(PyBytesObject *self, Py_ssize_t count) return PyErr_NoMemory(); if (size < self->ob_alloc) { Py_Size(self) = size; - self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */ + self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */ } else if (PyBytes_Resize((PyObject *)self, size) < 0) return NULL; @@ -816,7 +816,7 @@ static PyObject * bytes_repr(PyBytesObject *self) { static const char *hexdigits = "0123456789abcdef"; - size_t newsize = 3 + 4 * self->ob_size; + size_t newsize = 3 + 4 * Py_Size(self); PyObject *v; if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(self)) { PyErr_SetString(PyExc_OverflowError, @@ -2594,7 +2594,7 @@ static PyObject * bytes_join(PyBytesObject *self, PyObject *it) { PyObject *seq; - Py_ssize_t mysize = self->ob_size; + Py_ssize_t mysize = Py_Size(self); Py_ssize_t i; Py_ssize_t n; PyObject **items; @@ -2727,7 +2727,7 @@ bytes_reduce(PyBytesObject *self) return Py_BuildValue("(O(s#s))", Py_Type(self), self->ob_bytes == NULL ? "" : self->ob_bytes, - self->ob_size, + Py_Size(self), "latin-1"); } diff --git a/Objects/setobject.c b/Objects/setobject.c index cc60488349..a5366c89bf 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -619,21 +619,21 @@ set_repr(PySetObject *so) if (status != 0) { if (status < 0) return NULL; - return PyUnicode_FromFormat("%s(...)", so->ob_type->tp_name); + return PyUnicode_FromFormat("%s(...)", Py_Type(so)->tp_name); } /* shortcut for the empty set */ if (!so->used) { Py_ReprLeave((PyObject*)so); - return PyUnicode_FromFormat("%s()", so->ob_type->tp_name); + return PyUnicode_FromFormat("%s()", Py_Type(so)->tp_name); } keys = PySequence_List((PyObject *)so); if (keys == NULL) goto done; - if (so->ob_type != &PySet_Type) { - result = PyUnicode_FromFormat("%s(%R)", so->ob_type->tp_name, keys); + if (Py_Type(so) != &PySet_Type) { + result = PyUnicode_FromFormat("%s(%R)", Py_Type(so)->tp_name, keys); Py_DECREF(keys); } else { diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 6156b2f046..68dfd35de5 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -835,7 +835,7 @@ PyString_Repr(PyObject *obj, int smartquotes) static const char *hexdigits = "0123456789abcdef"; register PyStringObject* op = (PyStringObject*) obj; Py_ssize_t length = PyString_GET_SIZE(op); - size_t newsize = 3 + 4 * op->ob_size; + size_t newsize = 3 + 4 * Py_Size(op); PyObject *v; if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(op)) { PyErr_SetString(PyExc_OverflowError, diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index bf031bb4e9..6944eabd42 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -305,7 +305,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode) case SSTATE_INTERNED_MORTAL: /* revive dead object temporarily for DelItem */ - unicode->ob_refcnt = 3; + Py_Refcnt(unicode) = 3; if (PyDict_DelItem(interned, (PyObject *)unicode) != 0) Py_FatalError( "deletion of interned unicode string failed"); @@ -8758,7 +8758,7 @@ PyUnicode_InternInPlace(PyObject **p) PyThreadState_GET()->recursion_critical = 0; /* The two references in interned are not counted by refcnt. The deallocator will take care of this */ - s->ob_refcnt -= 2; + Py_Refcnt(s) -= 2; PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; } @@ -8812,11 +8812,11 @@ void _Py_ReleaseInternedUnicodeStrings(void) /* XXX Shouldn't happen */ break; case SSTATE_INTERNED_IMMORTAL: - s->ob_refcnt += 1; + Py_Refcnt(s) += 1; immortal_size += s->length; break; case SSTATE_INTERNED_MORTAL: - s->ob_refcnt += 2; + Py_Refcnt(s) += 2; mortal_size += s->length; break; default: |