mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
44afe2b35a
commit
6ced7c4333
6 changed files with 36 additions and 65 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue