summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-03-21 17:15:42 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-03-21 17:15:42 (GMT)
commit6ced7c433353208e5b9d4dc25018937f1c9ae87d (patch)
tree61efdd2c527ab2eeeff1dd306218b91efbe1b91d /Modules/_tkinter.c
parent44afe2b35a3f82f26d35a2cec507ec6d59e6d6d3 (diff)
downloadcpython-6ced7c433353208e5b9d4dc25018937f1c9ae87d.zip
cpython-6ced7c433353208e5b9d4dc25018937f1c9ae87d.tar.gz
cpython-6ced7c433353208e5b9d4dc25018937f1c9ae87d.tar.bz2
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.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c8
1 files changed, 3 insertions, 5 deletions
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 @@ static PyObject *
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 =