[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - cDocumentTemplate.c:1.46

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 9 May 2002 09:19:17 -0400


Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv3895

Modified Files:
	cDocumentTemplate.c 
Log Message:
avoid using PyObject_CallFunction when a single parameter may be a tuple

=== Zope/lib/python/DocumentTemplate/cDocumentTemplate.c 1.45 => 1.46 ===
 	       PyObject *md, PyObject *mda)
 {
-  PyObject *block, *t;
+  PyObject *block, *t, *args;
   int l, i, k=0, append;
 
   if ((l=PyList_Size(blocks)) < 0) return -1;
@@ -691,7 +691,12 @@
 
               if (! ( PyString_Check(t) || PyUnicode_Check(t) ) )
                 {
-                  ASSIGN(t, PyObject_CallFunction(ustr, "O", t));
+                  args = PyTuple_New(1);
+                  if(!args) return -1;
+                  PyTuple_SET_ITEM(args,0,t);
+                  t = PyObject_CallObject(ustr, args);
+                  Py_DECREF(args);
+                  args = NULL;
                   UNLESS(t) return -1;
                 }