summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-04-10 13:03:19 (GMT)
committerGuido van Rossum <guido@python.org>2000-04-10 13:03:19 (GMT)
commit5f8b12f27e1cce4ff7e5fd3594a83855db350784 (patch)
treee22cbef677adea1c62620bf4aff07055ebaf5e8a /Objects
parent5db862dd0cae0077b09a765220bb358e0e129449 (diff)
downloadcpython-5f8b12f27e1cce4ff7e5fd3594a83855db350784.zip
cpython-5f8b12f27e1cce4ff7e5fd3594a83855db350784.tar.gz
cpython-5f8b12f27e1cce4ff7e5fd3594a83855db350784.tar.bz2
Mark Hammond:
In line with a similar checkin to object.c a while ago, this patch gives a more descriptive error message for an attribute error on a class instance. The message now looks like: AttributeError: 'Descriptor' instance has no attribute 'GetReturnType'
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 8ee1344..4fb1167 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -592,7 +592,10 @@ instance_getattr1(inst, name)
if (v == NULL) {
v = class_lookup(inst->in_class, name, &class);
if (v == NULL) {
- PyErr_SetObject(PyExc_AttributeError, name);
+ PyErr_Format(PyExc_AttributeError,
+ "'%.50s' instance has no attribute '%.400s'",
+ PyString_AsString(inst->in_class->cl_name),
+ sname);
return NULL;
}
}