gh-130821: Add type information to error messages for invalid return type (GH-130835)
This commit is contained in:
@@ -1329,8 +1329,9 @@ module_get_annotations(PyObject *self, void *Py_UNUSED(ignored))
|
||||
return NULL;
|
||||
}
|
||||
if (!PyDict_Check(annotations)) {
|
||||
PyErr_Format(PyExc_TypeError, "__annotate__ returned non-dict of type '%.100s'",
|
||||
Py_TYPE(annotations)->tp_name);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"__annotate__() must return a dict, not %T",
|
||||
annotations);
|
||||
Py_DECREF(annotate);
|
||||
Py_DECREF(annotations);
|
||||
Py_DECREF(dict);
|
||||
|
||||
Reference in New Issue
Block a user