summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-27 02:43:46 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-27 02:43:46 (GMT)
commit39d43b46608b13f6248f87df1a4f9ba6c69c6652 (patch)
treea5d776fd96285f7f90edd66cf646041c9f1eaee3 /Objects
parenta68cad13aee2f3df45bde6f3217c02b9b270d2e5 (diff)
downloadcpython-39d43b46608b13f6248f87df1a4f9ba6c69c6652.zip
cpython-39d43b46608b13f6248f87df1a4f9ba6c69c6652.tar.gz
cpython-39d43b46608b13f6248f87df1a4f9ba6c69c6652.tar.bz2
correctly handle descrs with __missing__
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 931b1fc..dbf6411 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1155,13 +1155,14 @@ dict_subscript(PyDictObject *mp, register PyObject *key)
/* Look up __missing__ method if we're a subclass. */
PyObject *missing;
static PyObject *missing_str = NULL;
- if (missing_str == NULL)
- missing_str =
- PyString_InternFromString("__missing__");
- missing = _PyType_Lookup(Py_TYPE(mp), missing_str);
+ missing = _PyObject_LookupSpecial((PyObject *)mp,
+ "__missing__",
+ &missing_str);
if (missing != NULL)
return PyObject_CallFunctionObjArgs(missing,
- (PyObject *)mp, key, NULL);
+ key, NULL);
+ else if (PyErr_Occurred())
+ return NULL;
}
set_key_error(key);
return NULL;