mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)
This commit is contained in:
parent
aca7f574b0
commit
f8a4c03ede
5 changed files with 18 additions and 12 deletions
|
|
@ -117,7 +117,11 @@ static PyObject *
|
|||
BaseException_repr(PyBaseExceptionObject *self)
|
||||
{
|
||||
const char *name = _PyType_Name(Py_TYPE(self));
|
||||
return PyUnicode_FromFormat("%s%R", name, self->args);
|
||||
if (PyTuple_GET_SIZE(self->args) == 1)
|
||||
return PyUnicode_FromFormat("%s(%R)", name,
|
||||
PyTuple_GET_ITEM(self->args, 0));
|
||||
else
|
||||
return PyUnicode_FromFormat("%s%R", name, self->args);
|
||||
}
|
||||
|
||||
/* Pickling support */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue