Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Prev Previous commit
Next Next commit
Use a new shiny %T formatting.
  • Loading branch information
serhiy-storchaka committed Apr 8, 2024
commit 054f12f61f505d1bd72722976d916639a566ee68
8 changes: 4 additions & 4 deletions Modules/_ctypes/cfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,8 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size)
}
PyErr_Format(PyExc_TypeError,
"one character bytes, bytearray or integer "
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
"in range(256) expected, not %s",
Py_TYPE(value)->tp_name);
"in range(256) expected, not %T",
value);
return NULL;
}

Expand All @@ -1157,8 +1157,8 @@ u_set(void *ptr, PyObject *value, Py_ssize_t size)
wchar_t chars[2];
if (!PyUnicode_Check(value)) {
PyErr_Format(PyExc_TypeError,
"unicode character expected instead of %s instance",
Py_TYPE(value)->tp_name);
"unicode character expected instead of %T instance",
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
value);
return NULL;
}

Expand Down
8 changes: 4 additions & 4 deletions Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{
if (!PyUnicode_Check(v)) {
PyErr_Format(PyExc_TypeError,
"array item must be unicode character, not %s",
Py_TYPE(v)->tp_name);
"array item must be unicode character, not %T",
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
v);
return -1;
}

Expand Down Expand Up @@ -305,8 +305,8 @@ w_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{
if (!PyUnicode_Check(v)) {
PyErr_Format(PyExc_TypeError,
"array item must be unicode character, not %s",
Py_TYPE(v)->tp_name);
"array item must be unicode character, not %T",
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
v);
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ byte_converter(PyObject *arg, char *p)
return 1;
}
PyErr_Format(PyExc_TypeError,
"%%c requires an integer in range(256) or a single byte, not %s",
Py_TYPE(arg)->tp_name);
"%%c requires an integer in range(256) or a single byte, not %T",
arg);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -13989,8 +13989,8 @@ formatchar(PyObject *v)
if (x == -1 && PyErr_Occurred()) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
PyErr_Format(PyExc_TypeError,
"%%c requires int or unicode character, not %s",
Py_TYPE(v)->tp_name);
"%%c requires int or unicode character, not %T",
Comment thread
serhiy-storchaka marked this conversation as resolved.
Outdated
v);
return (Py_UCS4) -1;
}
return (Py_UCS4) -1;
Expand Down