mirror of
https://github.com/python/cpython.git
synced 2025-11-12 07:02:33 +00:00
super_getattro(): kill some dead code; explain a mystery.
This commit is contained in:
parent
3a3cca5b82
commit
2fd02eb80f
1 changed files with 4 additions and 18 deletions
|
|
@ -5355,23 +5355,6 @@ super_getattro(PyObject *self, PyObject *name)
|
||||||
if ((PyObject *)(su->type) == PyTuple_GET_ITEM(mro, i))
|
if ((PyObject *)(su->type) == PyTuple_GET_ITEM(mro, i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (i >= n && PyType_Check(su->obj)) {
|
|
||||||
starttype = (PyTypeObject *)(su->obj);
|
|
||||||
mro = starttype->tp_mro;
|
|
||||||
if (mro == NULL)
|
|
||||||
n = 0;
|
|
||||||
else {
|
|
||||||
assert(PyTuple_Check(mro));
|
|
||||||
n = PyTuple_GET_SIZE(mro);
|
|
||||||
}
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
if ((PyObject *)(su->type) ==
|
|
||||||
PyTuple_GET_ITEM(mro, i))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
i++;
|
i++;
|
||||||
res = NULL;
|
res = NULL;
|
||||||
for (; i < n; i++) {
|
for (; i < n; i++) {
|
||||||
|
|
@ -5383,6 +5366,9 @@ super_getattro(PyObject *self, PyObject *name)
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
res = PyDict_GetItem(dict, name);
|
res = PyDict_GetItem(dict, name);
|
||||||
|
/* Skip data descriptors because when obj_type is a
|
||||||
|
metaclass, we don't want to return its __class__
|
||||||
|
descriptor. See supers() in test_descr.py. */
|
||||||
if (res != NULL && !PyDescr_IsData(res)) {
|
if (res != NULL && !PyDescr_IsData(res)) {
|
||||||
Py_INCREF(res);
|
Py_INCREF(res);
|
||||||
f = res->ob_type->tp_descr_get;
|
f = res->ob_type->tp_descr_get;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue