Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 5939357..91b1b53 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2400,11 +2400,9 @@
Tktt_Repr(PyObject *self)
{
TkttObject *v = (TkttObject *)self;
- char buf[100];
-
- PyOS_snprintf(buf, sizeof(buf), "<tktimertoken at %p%s>", v,
- v->func == NULL ? ", handler deleted" : "");
- return PyUnicode_FromString(buf);
+ return PyUnicode_FromFormat("<tktimertoken at %p%s>",
+ v,
+ v->func == NULL ? ", handler deleted" : "");
}
static PyTypeObject Tktt_Type =