Skip to content

Commit b541b98

Browse files
authored
Avoid %T format in error message (#146)
The %T format was added to Python 3.13 (PEP 737).
1 parent ffae0ff commit b541b98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pythoncapi_compat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,8 @@ PyUnicodeWriter_WriteSubstring(PyUnicodeWriter *writer, PyObject *str,
14911491
Py_ssize_t start, Py_ssize_t end)
14921492
{
14931493
if (!PyUnicode_Check(str)) {
1494-
PyErr_Format(PyExc_TypeError, "expect str, not %T", str);
1494+
PyErr_Format(PyExc_TypeError, "expect str, not %s",
1495+
Py_TYPE(str)->tp_name);
14951496
return -1;
14961497
}
14971498
if (start < 0 || start > end) {

0 commit comments

Comments
 (0)