From bcf6a80ba4003a81e7eb22da1c80b6743d5b528b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 24 Jun 2025 11:34:16 +0200 Subject: [PATCH] Avoid %T format in error message The %T format was added to Python 3.13 (PEP 737). --- pythoncapi_compat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pythoncapi_compat.h b/pythoncapi_compat.h index 20646af..3320f68 100644 --- a/pythoncapi_compat.h +++ b/pythoncapi_compat.h @@ -1491,7 +1491,8 @@ PyUnicodeWriter_WriteSubstring(PyUnicodeWriter *writer, PyObject *str, Py_ssize_t start, Py_ssize_t end) { if (!PyUnicode_Check(str)) { - PyErr_Format(PyExc_TypeError, "expect str, not %T", str); + PyErr_Format(PyExc_TypeError, "expect str, not %s", + Py_TYPE(str)->tp_name); return -1; } if (start < 0 || start > end) {