mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue20284: Implement PEP461
This commit is contained in:
parent
8861502e07
commit
b95b56150f
10 changed files with 1185 additions and 158 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue