summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2015-01-24 04:05:18 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2015-01-24 04:05:18 (GMT)
commitb95b56150fc3e7834783b54acdddeaed4fe44e27 (patch)
treec1994946e84b457841024402b50f8a9640211cb4 /Objects/abstract.c
parent8861502e0746465c4124548681f05969c08f4cae (diff)
downloadcpython-b95b56150fc3e7834783b54acdddeaed4fe44e27.zip
cpython-b95b56150fc3e7834783b54acdddeaed4fe44e27.tar.gz
cpython-b95b56150fc3e7834783b54acdddeaed4fe44e27.tar.bz2
Issue20284: Implement PEP461
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 323c985..9ab60f2 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -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;