(root)/
Python-3.12.0/
Objects/
clinic/
structseq.c.h
       1  /*[clinic input]
       2  preserve
       3  [clinic start generated code]*/
       4  
       5  #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
       6  #  include "pycore_gc.h"            // PyGC_Head
       7  #  include "pycore_runtime.h"       // _Py_ID()
       8  #endif
       9  
      10  
      11  static PyObject *
      12  structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict);
      13  
      14  static PyObject *
      15  structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      16  {
      17      PyObject *return_value = NULL;
      18      #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
      19  
      20      #define NUM_KEYWORDS 2
      21      static struct {
      22          PyGC_Head _this_is_not_used;
      23          PyObject_VAR_HEAD
      24          PyObject *ob_item[NUM_KEYWORDS];
      25      } _kwtuple = {
      26          .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
      27          .ob_item = { &_Py_ID(sequence), &_Py_ID(dict), },
      28      };
      29      #undef NUM_KEYWORDS
      30      #define KWTUPLE (&_kwtuple.ob_base.ob_base)
      31  
      32      #else  // !Py_BUILD_CORE
      33      #  define KWTUPLE NULL
      34      #endif  // !Py_BUILD_CORE
      35  
      36      static const char * const _keywords[] = {"sequence", "dict", NULL};
      37      static _PyArg_Parser _parser = {
      38          .keywords = _keywords,
      39          .fname = "structseq",
      40          .kwtuple = KWTUPLE,
      41      };
      42      #undef KWTUPLE
      43      PyObject *argsbuf[2];
      44      PyObject * const *fastargs;
      45      Py_ssize_t nargs = PyTuple_GET_SIZE(args);
      46      Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
      47      PyObject *arg;
      48      PyObject *dict = NULL;
      49  
      50      fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
      51      if (!fastargs) {
      52          goto exit;
      53      }
      54      arg = fastargs[0];
      55      if (!noptargs) {
      56          goto skip_optional_pos;
      57      }
      58      dict = fastargs[1];
      59  skip_optional_pos:
      60      return_value = structseq_new_impl(type, arg, dict);
      61  
      62  exit:
      63      return return_value;
      64  }
      65  /*[clinic end generated code: output=802d5663c7d01024 input=a9049054013a1b77]*/