[Python-checkins] python/dist/src/Objects tupleobject.c,2.81,2.82
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sun Oct 12 14:24:35 EDT 2003
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv25726/Objects
Modified Files:
tupleobject.c
Log Message:
Extended tuple's C API to include a new function, PyTuple_Pack() that is
useful for rapidly building argument tuples without having to invoke the
more sophisticated machinery of Py_BuildValue().
Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.81
retrieving revision 2.82
diff -C2 -d -r2.81 -r2.82
*** tupleobject.c 7 May 2003 01:28:47 -0000 2.81
--- tupleobject.c 12 Oct 2003 18:24:33 -0000 2.82
***************
*** 131,134 ****
--- 131,156 ----
}
+ PyObject *
+ PyTuple_Pack(int n, ...)
+ {
+ int i;
+ PyObject *o;
+ PyObject *result;
+ va_list vargs;
+
+ va_start(vargs, n);
+ result = PyTuple_New(n);
+ if (result == NULL)
+ return NULL;
+ for (i = 0; i < n; i++) {
+ o = va_arg(vargs, PyObject *);
+ Py_INCREF(o);
+ PyTuple_SET_ITEM(result, i, o);
+ }
+ va_end(vargs);
+ return result;
+ }
+
+
/* Methods */
More information about the Python-checkins
mailing list