summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-05 16:19:33 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-05 16:19:33 (GMT)
commit5b0443cf3ef5799cd34fc5975b3225ecd07233ef (patch)
treeff35710d30c9415f828b6e5348a0828588427736
parent4254e76319c03ea6c41ee0779cb7e6075b0d106c (diff)
downloadcpython-5b0443cf3ef5799cd34fc5975b3225ecd07233ef.zip
cpython-5b0443cf3ef5799cd34fc5975b3225ecd07233ef.tar.gz
cpython-5b0443cf3ef5799cd34fc5975b3225ecd07233ef.tar.bz2
Use PyUnicode_FromFormat() directly in
zipimporter_repr().
-rw-r--r--Modules/zipimport.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index fd139f2..b56e6f5 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -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\">",
- archive, SEP, prefix);
+ return PyUnicode_FromFormat("<zipimporter object \"%.300s%c%.150s\">",
+ archive, SEP, prefix);
else
- PyOS_snprintf(buf, sizeof(buf),
- "<zipimporter object \"%.300s\">",
- archive);
- return PyUnicode_FromString(buf);
+ return PyUnicode_FromFormat("<zipimporter object \"%.300s\">",
+ archive);
}
/* return fullname.split(".")[-1] */