mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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'
This commit is contained in:
parent
5db862dd0c
commit
5f8b12f27e
1 changed files with 4 additions and 1 deletions
|
@ -592,7 +592,10 @@ instance_getattr1(inst, name)
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
v = class_lookup(inst->in_class, name, &class);
|
v = class_lookup(inst->in_class, name, &class);
|
||||||
if (v == NULL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue