bpo-28280: Make PyMapping_Keys(), PyMapping_Values() and PyMapping_Items() always return a list by orenmn · Pull Request #3840 · python/cpython (original) (raw)
IIUC, you suggest something like:
PyErr_Format(PyExc_TypeError,
"%.200s.%U() returned a non-iterable (type %.200s)",
Py_TYPE(o)->tp_name,
PyUnicode_FromString(meth_id->string),
Py_TYPE(meth_output)->tp_name);
But then i would also have to handle refcounts, and the case in which PyUnicode_FromString()
failed. Do you think it's worth it?