summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-14 21:20:26 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-14 21:20:26 (GMT)
commit2fd02eb80fdfd7b651d3df7e09a0b076e126cc03 (patch)
tree5ef8ba6c532e1819e9f6af2d6bb9f9f3cf373490
parent3a3cca5b820084d759b06aed84b1070a56786af5 (diff)
downloadcpython-2fd02eb80fdfd7b651d3df7e09a0b076e126cc03.zip
cpython-2fd02eb80fdfd7b651d3df7e09a0b076e126cc03.tar.gz
cpython-2fd02eb80fdfd7b651d3df7e09a0b076e126cc03.tar.bz2
super_getattro(): kill some dead code; explain a mystery.
-rw-r--r--Objects/typeobject.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 1c1b197..a900f55 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5355,23 +5355,6 @@ super_getattro(PyObject *self, PyObject *name)
if ((PyObject *)(su->type) == PyTuple_GET_ITEM(mro, i))
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++;
res = NULL;
for (; i < n; i++) {
@@ -5383,7 +5366,10 @@ super_getattro(PyObject *self, PyObject *name)
else
continue;
res = PyDict_GetItem(dict, name);
- if (res != NULL && !PyDescr_IsData(res)) {
+ /* 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)) {
Py_INCREF(res);
f = res->ob_type->tp_descr_get;
if (f != NULL) {