Commit 5b0443cf authored by Walter Dörwald's avatar Walter Dörwald

Use PyUnicode_FromFormat() directly in

zipimporter_repr().
parent 4254e763
......@@ -187,7 +187,6 @@ zipimporter_dealloc(ZipImporter *self)
static PyObject *
zipimporter_repr(ZipImporter *self)
{
char buf[500];
char *archive = "???";
char *prefix = "";
......@@ -196,14 +195,11 @@ zipimporter_repr(ZipImporter *self)
if (self->prefix != NULL && PyString_Check(self->prefix))
prefix = PyString_AsString(self->prefix);
if (prefix != NULL && *prefix)
PyOS_snprintf(buf, sizeof(buf),
"<zipimporter object \"%.300s%c%.150s\">",
return PyUnicode_FromFormat("<zipimporter object \"%.300s%c%.150s\">",
archive, SEP, prefix);
else
PyOS_snprintf(buf, sizeof(buf),
"<zipimporter object \"%.300s\">",
return PyUnicode_FromFormat("<zipimporter object \"%.300s\">",
archive);
return PyUnicode_FromString(buf);
}
/* return fullname.split(".")[-1] */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment