Skip to content

Commit a088e53

Browse files
committed
Add full qualified name for abc class execption.
1 parent 852381e commit a088e53

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Objects/typeobject.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7340,13 +7340,20 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
73407340
return NULL;
73417341
}
73427342

7343+
PyObject *type_name = _PyType_GetFullyQualifiedName(type, '.');
7344+
if (type_name == NULL) {
7345+
Py_DECREF(joined);
7346+
return NULL;
7347+
}
7348+
73437349
PyErr_Format(PyExc_TypeError,
7344-
"Can't instantiate abstract class %s "
7350+
"Can't instantiate abstract class %U "
73457351
"without an implementation for abstract method%s '%U'",
7346-
type->tp_name,
7352+
type_name,
73477353
method_count > 1 ? "s" : "",
73487354
joined);
73497355
Py_DECREF(joined);
7356+
Py_DECREF(type_name);
73507357
return NULL;
73517358
}
73527359
PyObject *obj = type->tp_alloc(type, 0);

0 commit comments

Comments
 (0)