-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Expand file tree
/
Copy pathtuple.c
More file actions
39 lines (30 loc) · 853 Bytes
/
tuple.c
File metadata and controls
39 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "parts.h"
#include "pycore_tuple.h"
static PyObject *
tuple_from_pair(PyObject *Py_UNUSED(module), PyObject *args)
{
PyObject *first, *second;
if (!PyArg_ParseTuple(args, "OO", &first, &second)) {
return NULL;
}
return _PyTuple_FromPair(first, second);
}
static PyObject *
tuple_from_pair_steal(PyObject *Py_UNUSED(module), PyObject *args)
{
PyObject *first, *second;
if (!PyArg_ParseTuple(args, "OO", &first, &second)) {
return NULL;
}
return _PyTuple_FromPairSteal(Py_NewRef(first), Py_NewRef(second));
}
static PyMethodDef test_methods[] = {
{"tuple_from_pair", tuple_from_pair, METH_VARARGS},
{"tuple_from_pair_steal", tuple_from_pair_steal, METH_VARARGS},
{NULL},
};
int
_PyTestInternalCapi_Init_Tuple(PyObject *m)
{
return PyModule_AddFunctions(m, test_methods);
}