diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-14 16:25:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-14 16:25:31 (GMT) |
commit | 91108f049ffb35b4b9f0353a41d9c6097b37046d (patch) | |
tree | cfa8d97b646af5c3544f43bed2bc4ca46c85392e /Objects | |
parent | dbb98c1443fa312964cda8b851c7bca9323588de (diff) | |
download | cpython-91108f049ffb35b4b9f0353a41d9c6097b37046d.zip cpython-91108f049ffb35b4b9f0353a41d9c6097b37046d.tar.gz cpython-91108f049ffb35b4b9f0353a41d9c6097b37046d.tar.bz2 |
Issue #25210: Change error message of do_richcompare()
Don't add parenthesis to type names. Add also quotes around the type names.
Before:
TypeError: unorderable types: int() < NoneType()
After:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/object.c b/Objects/object.c index 6fc4df1..e1718ea 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -686,11 +686,10 @@ do_richcompare(PyObject *v, PyObject *w, int op) res = (v != w) ? Py_True : Py_False; break; default: - /* XXX Special-case None so it doesn't show as NoneType() */ PyErr_Format(PyExc_TypeError, - "unorderable types: %.100s() %s %.100s()", - v->ob_type->tp_name, + "'%s' not supported between instances of '%.100s' and '%.100s'", opstrings[op], + v->ob_type->tp_name, w->ob_type->tp_name); return NULL; } |