diff options
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 3c766e9..8ee4e81 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1065,6 +1065,12 @@ static PyGetSetDef type_getsets[] = { static PyObject * type_repr(PyTypeObject *type) { + if (type->tp_name == NULL) { + // type_repr() called before the type is fully initialized + // by PyType_Ready(). + return PyUnicode_FromFormat("<class at %p>", type); + } + PyObject *mod, *name, *rtn; mod = type_module(type, NULL); |