Skip to content

Commit 054f12f

Browse files
Use a new shiny %T formatting.
1 parent 2d1d46f commit 054f12f

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Modules/_ctypes/cfield.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,8 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size)
11371137
}
11381138
PyErr_Format(PyExc_TypeError,
11391139
"one character bytes, bytearray or integer "
1140-
"in range(256) expected, not %s",
1141-
Py_TYPE(value)->tp_name);
1140+
"in range(256) expected, not %T",
1141+
value);
11421142
return NULL;
11431143
}
11441144

@@ -1157,8 +1157,8 @@ u_set(void *ptr, PyObject *value, Py_ssize_t size)
11571157
wchar_t chars[2];
11581158
if (!PyUnicode_Check(value)) {
11591159
PyErr_Format(PyExc_TypeError,
1160-
"unicode character expected instead of %s instance",
1161-
Py_TYPE(value)->tp_name);
1160+
"unicode character expected instead of %T instance",
1161+
value);
11621162
return NULL;
11631163
}
11641164

Modules/arraymodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
262262
{
263263
if (!PyUnicode_Check(v)) {
264264
PyErr_Format(PyExc_TypeError,
265-
"array item must be unicode character, not %s",
266-
Py_TYPE(v)->tp_name);
265+
"array item must be unicode character, not %T",
266+
v);
267267
return -1;
268268
}
269269

@@ -305,8 +305,8 @@ w_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
305305
{
306306
if (!PyUnicode_Check(v)) {
307307
PyErr_Format(PyExc_TypeError,
308-
"array item must be unicode character, not %s",
309-
Py_TYPE(v)->tp_name);
308+
"array item must be unicode character, not %T",
309+
v);
310310
return -1;
311311
}
312312

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ byte_converter(PyObject *arg, char *p)
515515
return 1;
516516
}
517517
PyErr_Format(PyExc_TypeError,
518-
"%%c requires an integer in range(256) or a single byte, not %s",
519-
Py_TYPE(arg)->tp_name);
518+
"%%c requires an integer in range(256) or a single byte, not %T",
519+
arg);
520520
return 0;
521521
}
522522

Objects/unicodeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13989,8 +13989,8 @@ formatchar(PyObject *v)
1398913989
if (x == -1 && PyErr_Occurred()) {
1399013990
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
1399113991
PyErr_Format(PyExc_TypeError,
13992-
"%%c requires int or unicode character, not %s",
13993-
Py_TYPE(v)->tp_name);
13992+
"%%c requires int or unicode character, not %T",
13993+
v);
1399413994
return (Py_UCS4) -1;
1399513995
}
1399613996
return (Py_UCS4) -1;

0 commit comments

Comments
 (0)