diff options
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/Objects/object.c b/Objects/object.c index de385ea347..788e7320e3 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -214,7 +214,7 @@ PyObject_Init(PyObject *op, PyTypeObject *tp) if (op == NULL) return PyErr_NoMemory(); /* Any changes should be reflected in PyObject_INIT (objimpl.h) */ - Py_Type(op) = tp; + Py_TYPE(op) = tp; _Py_NewReference(op); return op; } @@ -226,7 +226,7 @@ PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size) return (PyVarObject *) PyErr_NoMemory(); /* Any changes should be reflected in PyObject_INIT_VAR */ op->ob_size = size; - Py_Type(op) = tp; + Py_TYPE(op) = tp; _Py_NewReference((PyObject *)op); return op; } @@ -291,7 +291,7 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting) fprintf(fp, "<refcnt %ld at %p>", (long)op->ob_refcnt, op); Py_END_ALLOW_THREADS - else if (Py_Type(op)->tp_print == NULL) { + else if (Py_TYPE(op)->tp_print == NULL) { PyObject *s; if (flags & Py_PRINT_RAW) s = PyObject_Str(op); @@ -306,7 +306,7 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting) Py_XDECREF(s); } else - ret = (*Py_Type(op)->tp_print)(op, fp, flags); + ret = (*Py_TYPE(op)->tp_print)(op, fp, flags); } if (ret == 0) { if (ferror(fp)) { @@ -339,7 +339,7 @@ void _PyObject_Dump(PyObject* op) "type : %s\n" "refcount: %ld\n" "address : %p\n", - Py_Type(op)==NULL ? "NULL" : Py_Type(op)->tp_name, + Py_TYPE(op)==NULL ? "NULL" : Py_TYPE(op)->tp_name, (long)op->ob_refcnt, op); } @@ -358,12 +358,12 @@ PyObject_Repr(PyObject *v) #endif if (v == NULL) return PyString_FromString("<NULL>"); - else if (Py_Type(v)->tp_repr == NULL) + else if (Py_TYPE(v)->tp_repr == NULL) return PyString_FromFormat("<%s object at %p>", - Py_Type(v)->tp_name, v); + Py_TYPE(v)->tp_name, v); else { PyObject *res; - res = (*Py_Type(v)->tp_repr)(v); + res = (*Py_TYPE(v)->tp_repr)(v); if (res == NULL) return NULL; #ifdef Py_USING_UNICODE @@ -380,7 +380,7 @@ PyObject_Repr(PyObject *v) if (!PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", - Py_Type(res)->tp_name); + Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } @@ -405,14 +405,14 @@ _PyObject_Str(PyObject *v) return v; } #endif - if (Py_Type(v)->tp_str == NULL) + if (Py_TYPE(v)->tp_str == NULL) return PyObject_Repr(v); /* It is possible for a type to have a tp_str representation that loops infinitely. */ if (Py_EnterRecursiveCall(" while getting the str of an object")) return NULL; - res = (*Py_Type(v)->tp_str)(v); + res = (*Py_TYPE(v)->tp_str)(v); Py_LeaveRecursiveCall(); if (res == NULL) return NULL; @@ -423,7 +423,7 @@ _PyObject_Str(PyObject *v) if (!type_ok) { PyErr_Format(PyExc_TypeError, "__str__ returned non-string (type %.200s)", - Py_Type(res)->tp_name); + Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } @@ -497,8 +497,8 @@ PyObject_Unicode(PyObject *v) res = v; } else { - if (Py_Type(v)->tp_str != NULL) - res = (*Py_Type(v)->tp_str)(v); + if (Py_TYPE(v)->tp_str != NULL) + res = (*Py_TYPE(v)->tp_str)(v); else res = PyObject_Repr(v); } @@ -1071,8 +1071,8 @@ PyObject_GetAttrString(PyObject *v, const char *name) { PyObject *w, *res; - if (Py_Type(v)->tp_getattr != NULL) - return (*Py_Type(v)->tp_getattr)(v, (char*)name); + if (Py_TYPE(v)->tp_getattr != NULL) + return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); w = PyString_InternFromString(name); if (w == NULL) return NULL; @@ -1099,8 +1099,8 @@ PyObject_SetAttrString(PyObject *v, const char *name, PyObject *w) PyObject *s; int res; - if (Py_Type(v)->tp_setattr != NULL) - return (*Py_Type(v)->tp_setattr)(v, (char*)name, w); + if (Py_TYPE(v)->tp_setattr != NULL) + return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); s = PyString_InternFromString(name); if (s == NULL) return -1; @@ -1112,7 +1112,7 @@ PyObject_SetAttrString(PyObject *v, const char *name, PyObject *w) PyObject * PyObject_GetAttr(PyObject *v, PyObject *name) { - PyTypeObject *tp = Py_Type(v); + PyTypeObject *tp = Py_TYPE(v); if (!PyString_Check(name)) { #ifdef Py_USING_UNICODE @@ -1129,7 +1129,7 @@ PyObject_GetAttr(PyObject *v, PyObject *name) { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", - Py_Type(name)->tp_name); + Py_TYPE(name)->tp_name); return NULL; } } @@ -1158,7 +1158,7 @@ PyObject_HasAttr(PyObject *v, PyObject *name) int PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) { - PyTypeObject *tp = Py_Type(v); + PyTypeObject *tp = Py_TYPE(v); int err; if (!PyString_Check(name)){ @@ -1176,7 +1176,7 @@ PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", - Py_Type(name)->tp_name); + Py_TYPE(name)->tp_name); return -1; } } @@ -1218,7 +1218,7 @@ PyObject ** _PyObject_GetDictPtr(PyObject *obj) { Py_ssize_t dictoffset; - PyTypeObject *tp = Py_Type(obj); + PyTypeObject *tp = Py_TYPE(obj); if (!(tp->tp_flags & Py_TPFLAGS_HAVE_CLASS)) return NULL; @@ -1253,7 +1253,7 @@ PyObject_SelfIter(PyObject *obj) PyObject * PyObject_GenericGetAttr(PyObject *obj, PyObject *name) { - PyTypeObject *tp = Py_Type(obj); + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr = NULL; PyObject *res = NULL; descrgetfunc f; @@ -1275,7 +1275,7 @@ PyObject_GenericGetAttr(PyObject *obj, PyObject *name) { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", - Py_Type(name)->tp_name); + Py_TYPE(name)->tp_name); return NULL; } } @@ -1355,7 +1355,7 @@ PyObject_GenericGetAttr(PyObject *obj, PyObject *name) } if (f != NULL) { - res = f(descr, obj, (PyObject *)Py_Type(obj)); + res = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto done; } @@ -1377,7 +1377,7 @@ PyObject_GenericGetAttr(PyObject *obj, PyObject *name) int PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = Py_Type(obj); + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrsetfunc f; PyObject **dictptr; @@ -1398,7 +1398,7 @@ PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value) { PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", - Py_Type(name)->tp_name); + Py_TYPE(name)->tp_name); return -1; } } @@ -1692,7 +1692,7 @@ _dir_locals(void) if (!PyList_Check(names)) { PyErr_Format(PyExc_TypeError, "dir(): expected keys() of locals to be a list, " - "not '%.200s'", Py_Type(names)->tp_name); + "not '%.200s'", Py_TYPE(names)->tp_name); Py_DECREF(names); return NULL; } @@ -1827,7 +1827,7 @@ _dir_object(PyObject *obj) if (!PyList_Check(result)) { PyErr_Format(PyExc_TypeError, "__dir__() must return a list, not %.200s", - Py_Type(result)->tp_name); + Py_TYPE(result)->tp_name); Py_DECREF(result); result = NULL; } @@ -2006,7 +2006,7 @@ _Py_ForgetReference(register PyObject *op) void _Py_Dealloc(PyObject *op) { - destructor dealloc = Py_Type(op)->tp_dealloc; + destructor dealloc = Py_TYPE(op)->tp_dealloc; _Py_ForgetReference(op); (*dealloc)(op); } @@ -2037,7 +2037,7 @@ _Py_PrintReferenceAddresses(FILE *fp) 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); + op->ob_refcnt, Py_TYPE(op)->tp_name); } PyObject * @@ -2055,7 +2055,7 @@ _Py_GetObjects(PyObject *self, PyObject *args) return NULL; for (i = 0; (n == 0 || i < n) && op != &refchain; i++) { while (op == self || op == args || op == res || op == t || - (t != NULL && Py_Type(op) != (PyTypeObject *) t)) { + (t != NULL && Py_TYPE(op) != (PyTypeObject *) t)) { op = op->_ob_next; if (op == &refchain) return res; @@ -2198,7 +2198,7 @@ _PyTrash_destroy_chain(void) { while (_PyTrash_delete_later) { PyObject *op = _PyTrash_delete_later; - destructor dealloc = Py_Type(op)->tp_dealloc; + destructor dealloc = Py_TYPE(op)->tp_dealloc; _PyTrash_delete_later = (PyObject*) _Py_AS_GC(op)->gc.gc_prev; |