Skip to content

Commit e15dd85

Browse files
committed
Use PyUnicode_FromFormat instead of a buffer
1 parent ce6f79c commit e15dd85

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Modules/_zstd/zdict.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,8 @@ PyDoc_STRVAR(ZstdDict_dictcontent_doc,
147147
static PyObject *
148148
ZstdDict_str(ZstdDict *dict)
149149
{
150-
char buf[64];
151-
PyOS_snprintf(buf, sizeof(buf),
152-
"<ZstdDict dict_id=%u dict_size=%zd>",
153-
dict->dict_id, Py_SIZE(dict->dict_content));
154-
155-
return PyUnicode_FromString(buf);
150+
return PyUnicode_FromFormat("<ZstdDict dict_id=%u dict_size=%zd>",
151+
dict->dict_id, Py_SIZE(dict->dict_content));
156152
}
157153

158154
static PyMemberDef ZstdDict_members[] = {

0 commit comments

Comments
 (0)