row.c.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. static PyObject *
  9. pysqlite_row_new_impl(PyTypeObject *type, pysqlite_Cursor *cursor,
  10. PyObject *data);
  11. static PyObject *
  12. pysqlite_row_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
  13. {
  14. PyObject *return_value = NULL;
  15. PyTypeObject *base_tp = clinic_state()->RowType;
  16. pysqlite_Cursor *cursor;
  17. PyObject *data;
  18. if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
  19. !_PyArg_NoKeywords("Row", kwargs)) {
  20. goto exit;
  21. }
  22. if (!_PyArg_CheckPositional("Row", PyTuple_GET_SIZE(args), 2, 2)) {
  23. goto exit;
  24. }
  25. if (!PyObject_TypeCheck(PyTuple_GET_ITEM(args, 0), clinic_state()->CursorType)) {
  26. _PyArg_BadArgument("Row", "argument 1", (clinic_state()->CursorType)->tp_name, PyTuple_GET_ITEM(args, 0));
  27. goto exit;
  28. }
  29. cursor = (pysqlite_Cursor *)PyTuple_GET_ITEM(args, 0);
  30. if (!PyTuple_Check(PyTuple_GET_ITEM(args, 1))) {
  31. _PyArg_BadArgument("Row", "argument 2", "tuple", PyTuple_GET_ITEM(args, 1));
  32. goto exit;
  33. }
  34. data = PyTuple_GET_ITEM(args, 1);
  35. return_value = pysqlite_row_new_impl(type, cursor, data);
  36. exit:
  37. return return_value;
  38. }
  39. PyDoc_STRVAR(pysqlite_row_keys__doc__,
  40. "keys($self, /)\n"
  41. "--\n"
  42. "\n"
  43. "Returns the keys of the row.");
  44. #define PYSQLITE_ROW_KEYS_METHODDEF \
  45. {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS, pysqlite_row_keys__doc__},
  46. static PyObject *
  47. pysqlite_row_keys_impl(pysqlite_Row *self);
  48. static PyObject *
  49. pysqlite_row_keys(pysqlite_Row *self, PyObject *Py_UNUSED(ignored))
  50. {
  51. return pysqlite_row_keys_impl(self);
  52. }
  53. /*[clinic end generated code: output=157b31ac3f6af1ba input=a9049054013a1b77]*/