[Python-3000-checkins] r55764 - python/branches/py3k-struni/Modules/zipimport.c

walter.doerwald python-3000-checkins at python.org
Tue Jun 5 18:19:37 CEST 2007


Author: walter.doerwald
Date: Tue Jun  5 18:19:33 2007
New Revision: 55764

Modified:
   python/branches/py3k-struni/Modules/zipimport.c
Log:
Use PyUnicode_FromFormat() directly in
zipimporter_repr().


Modified: python/branches/py3k-struni/Modules/zipimport.c
==============================================================================
--- python/branches/py3k-struni/Modules/zipimport.c	(original)
+++ python/branches/py3k-struni/Modules/zipimport.c	Tue Jun  5 18:19:33 2007
@@ -187,7 +187,6 @@
 static PyObject *
 zipimporter_repr(ZipImporter *self)
 {
-	char buf[500];
 	char *archive = "???";
 	char *prefix = "";
 
@@ -196,14 +195,11 @@
 	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] */


More information about the Python-3000-checkins mailing list