cpython: e5149789e4ea (original) (raw)
--- a/Objects/object.c +++ b/Objects/object.c @@ -1040,8 +1040,7 @@ PyObject * name->ob_type->tp_name); return NULL; }
if (tp->tp_dict == NULL) { if (PyType_Ready(tp) < 0) @@ -1049,10 +1048,10 @@ PyObject * } descr = _PyType_Lookup(tp, name);
f = NULL; if (descr != NULL) {
Py_INCREF(descr);[](#l1.21) f = descr->ob_type->tp_descr_get;[](#l1.22) if (f != NULL && PyDescr_IsData(descr)) {[](#l1.23) res = f(descr, obj, (PyObject *)obj->ob_type);[](#l1.24)
@@ -1072,8 +1071,9 @@ PyObject * if (tsize < 0) tsize = -tsize; size = _PyObject_VAR_SIZE(tp, tsize);
assert(size <= PY_SSIZE_T_MAX);[](#l1.29)
dictoffset += (long)size;[](#l1.31)
dictoffset += (Py_ssize_t)size;[](#l1.32) assert(dictoffset > 0);[](#l1.33) assert(dictoffset % SIZEOF_VOID_P == 0);[](#l1.34) }[](#l1.35)
@@ -1141,12 +1141,11 @@ int Py_INCREF(name); descr = _PyType_Lookup(tp, name);
Py_INCREF(descr);[](#l1.44) f = descr->ob_type->tp_descr_set;[](#l1.45)
if (f != NULL && PyDescr_IsData(descr)) {[](#l1.46)
if (f != NULL) {[](#l1.47) res = f(descr, obj, value);[](#l1.48) goto done;[](#l1.49) }[](#l1.50)
@@ -1154,40 +1153,32 @@ int if (dict == NULL) { dictptr = _PyObject_GetDictPtr(obj);
if (dictptr != NULL) {[](#l1.55)
res = _PyObjectDict_SetItem(Py_TYPE(obj), dictptr, name, value);[](#l1.56)
if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))[](#l1.57)
PyErr_SetObject(PyExc_AttributeError, name);[](#l1.58)
if (dictptr == NULL) {[](#l1.59)
if (descr == NULL) {[](#l1.60)
PyErr_Format(PyExc_AttributeError,[](#l1.61)
"'%.100s' object has no attribute '%U'",[](#l1.62)
tp->tp_name, name);[](#l1.63)
}[](#l1.64)
else {[](#l1.65)
PyErr_Format(PyExc_AttributeError,[](#l1.66)
"'%.50s' object attribute '%U' is read-only",[](#l1.67)
tp->tp_name, name);[](#l1.68)
}[](#l1.69) goto done;[](#l1.70) }[](#l1.71)
}res = _PyObjectDict_SetItem(tp, dictptr, name, value);[](#l1.72)
- else { Py_INCREF(dict); if (value == NULL) res = PyDict_DelItem(dict, name); else res = PyDict_SetItem(dict, name, value); Py_DECREF(dict);
if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))[](#l1.82)
PyErr_SetObject(PyExc_AttributeError, name);[](#l1.83)
} -goto done;[](#l1.84)
- if (f != NULL) {
res = f(descr, obj, value);[](#l1.88)
goto done;[](#l1.89)
- }
- if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
PyErr_SetObject(PyExc_AttributeError, name);[](#l1.92)