mirror of
https://github.com/python/cpython.git
synced 2026-04-15 16:21:24 +00:00
40 lines
853 B
C
40 lines
853 B
C
|
|
#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);
|
||
|
|
}
|