diff options
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 5430924e69d..b1f9f1280fd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2359,7 +2359,7 @@ static PyObject * class_name(PyObject *cls) { PyObject *name; - if (_PyObject_LookupAttr(cls, &_Py_ID(__name__), &name) == 0) { + if (PyObject_GetOptionalAttr(cls, &_Py_ID(__name__), &name) == 0) { name = PyObject_Repr(cls); } return name; @@ -3865,7 +3865,7 @@ type_new_get_bases(type_new_ctx *ctx, PyObject **type) continue; } PyObject *mro_entries; - if (_PyObject_LookupAttr(base, &_Py_ID(__mro_entries__), + if (PyObject_GetOptionalAttr(base, &_Py_ID(__mro_entries__), &mro_entries) < 0) { return -1; } @@ -5147,7 +5147,7 @@ merge_class_dict(PyObject *dict, PyObject *aclass) assert(aclass); /* Merge in the type's dict (if any). */ - if (_PyObject_LookupAttr(aclass, &_Py_ID(__dict__), &classdict) < 0) { + if (PyObject_GetOptionalAttr(aclass, &_Py_ID(__dict__), &classdict) < 0) { return -1; } if (classdict != NULL) { @@ -5158,7 +5158,7 @@ merge_class_dict(PyObject *dict, PyObject *aclass) } /* Recursively merge in the base types' (if any) dicts. */ - if (_PyObject_LookupAttr(aclass, &_Py_ID(__bases__), &bases) < 0) { + if (PyObject_GetOptionalAttr(aclass, &_Py_ID(__bases__), &bases) < 0) { return -1; } if (bases != NULL) { @@ -5984,7 +5984,7 @@ object_getstate_default(PyObject *obj, int required) PyObject *name, *value; name = Py_NewRef(PyList_GET_ITEM(slotnames, i)); - if (_PyObject_LookupAttr(obj, name, &value) < 0) { + if (PyObject_GetOptionalAttr(obj, name, &value) < 0) { Py_DECREF(name); goto error; } @@ -6381,7 +6381,7 @@ object___reduce_ex___impl(PyObject *self, int protocol) } } - if (_PyObject_LookupAttr(self, &_Py_ID(__reduce__), &reduce) < 0) { + if (PyObject_GetOptionalAttr(self, &_Py_ID(__reduce__), &reduce) < 0) { return NULL; } if (reduce != NULL) { @@ -6500,7 +6500,7 @@ object___dir___impl(PyObject *self) PyObject *itsclass = NULL; /* Get __dict__ (which may or may not be a real dict...) */ - if (_PyObject_LookupAttr(self, &_Py_ID(__dict__), &dict) < 0) { + if (PyObject_GetOptionalAttr(self, &_Py_ID(__dict__), &dict) < 0) { return NULL; } if (dict == NULL) { @@ -6520,7 +6520,7 @@ object___dir___impl(PyObject *self) goto error; /* Merge in attrs reachable from its class. */ - if (_PyObject_LookupAttr(self, &_Py_ID(__class__), &itsclass) < 0) { + if (PyObject_GetOptionalAttr(self, &_Py_ID(__class__), &itsclass) < 0) { goto error; } /* XXX(tomer): Perhaps fall back to Py_TYPE(obj) if no @@ -8393,7 +8393,7 @@ method_is_overloaded(PyObject *left, PyObject *right, PyObject *name) PyObject *a, *b; int ok; - if (_PyObject_LookupAttr((PyObject *)(Py_TYPE(right)), name, &b) < 0) { + if (PyObject_GetOptionalAttr((PyObject *)(Py_TYPE(right)), name, &b) < 0) { return -1; } if (b == NULL) { @@ -8401,7 +8401,7 @@ method_is_overloaded(PyObject *left, PyObject *right, PyObject *name) return 0; } - if (_PyObject_LookupAttr((PyObject *)(Py_TYPE(left)), name, &a) < 0) { + if (PyObject_GetOptionalAttr((PyObject *)(Py_TYPE(left)), name, &a) < 0) { Py_DECREF(b); return -1; } @@ -10373,7 +10373,7 @@ supercheck(PyTypeObject *type, PyObject *obj) /* Try the slow way */ PyObject *class_attr; - if (_PyObject_LookupAttr(obj, &_Py_ID(__class__), &class_attr) < 0) { + if (PyObject_GetOptionalAttr(obj, &_Py_ID(__class__), &class_attr) < 0) { return NULL; } if (class_attr != NULL && |