Issue20284: Implement PEP461

This commit is contained in:
Ethan Furman 2015-01-23 20:05:18 -08:00
parent 8861502e07
commit b95b56150f
10 changed files with 1185 additions and 158 deletions

View file

@ -686,8 +686,9 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
Py_DECREF(meth);
if (result && !PyUnicode_Check(result)) {
PyErr_SetString(PyExc_TypeError,
"__format__ method did not return string");
PyErr_Format(PyExc_TypeError,
"__format__ must return a str, not %.200s",
Py_TYPE(result)->tp_name);
Py_DECREF(result);
result = NULL;
goto done;