Debian Codegraph @

pypy/module/cpyext/src/varargwrapper.c

raw symbols SCIP
1 #include <Python.h>
2 #include <stdarg.h>
3
4 #ifdef CPYEXT_TESTS
5 #define PyTuplePack _cpyexttestTuplePack
6 #ifdef __GNUC__
7 __attribute__((visibility("default")))
8 #else
9 __declspec(dllexport)
10 #endif
11 #else /* CPYEXT_TESTS */
12 #define PyTuplePack PyPyTuplePack
13 #endif /* CPYEXT_TESTS */
14
15
16 PyObject *
17 PyTuple_Pack(Py_ssize_t n, ...)
18 {
19 Py_ssize_t i;
20 PyObject *o;
21 PyObject *result;
22 va_list vargs;
23
24 va_start(vargs, n);
25 result = PyTuple_New(n);
26 if (result == NULL)
27 return NULL;
28 for (i = 0; i < n; i++) {
29 o = va_arg(vargs, PyObject *);
30 Py_INCREF(o);
31 if (PyTuple_SetItem(result, i, o) < 0)
32 return NULL;
33 }
34 va_end(vargs);
35 return result;
36 }