Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db93516

Browse files
committed
Instead of "attribute-less object", issue an error message that
contains the type of the object and name of the attribute.
1 parent cf57d8b commit db93516

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Objects/object.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ PyObject_GetAttrString(v, name)
348348
}
349349

350350
if (v->ob_type->tp_getattr == NULL) {
351-
PyErr_SetString(PyExc_AttributeError, "attribute-less object");
351+
PyErr_Format(PyExc_AttributeError,
352+
"'%.50s' object has no attribute '%.400s'",
353+
v->ob_type->tp_name,
354+
name);
352355
return NULL;
353356
}
354357
else {

0 commit comments

Comments
 (0)