diff options
Diffstat (limited to 'Modules/_io/clinic/stringio.c.h')
-rw-r--r-- | Modules/_io/clinic/stringio.c.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h index 6758ee0..d853cf4 100644 --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -2,6 +2,12 @@ preserve [clinic start generated code]*/ +#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() +#endif + + PyDoc_STRVAR(_io_StringIO_getvalue__doc__, "getvalue($self, /)\n" "--\n" @@ -255,8 +261,41 @@ static int _io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; + #define NUM_KEYWORDS 2 + #if NUM_KEYWORDS == 0 + + # if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) + # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) + # else + # define KWTUPLE NULL + # endif + + #else // NUM_KEYWORDS != 0 + # if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) + + static struct { + PyGC_Head _this_is_not_used; + PyObject_VAR_HEAD + PyObject *ob_item[NUM_KEYWORDS]; + } _kwtuple = { + .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) + .ob_item = { &_Py_ID(initial_value), &_Py_ID(newline), }, + }; + # define KWTUPLE (&_kwtuple.ob_base.ob_base) + + # else // !Py_BUILD_CORE + # define KWTUPLE NULL + # endif // !Py_BUILD_CORE + #endif // NUM_KEYWORDS != 0 + #undef NUM_KEYWORDS + static const char * const _keywords[] = {"initial_value", "newline", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "StringIO", 0}; + static _PyArg_Parser _parser = { + .keywords = _keywords, + .fname = "StringIO", + .kwtuple = KWTUPLE, + }; + #undef KWTUPLE PyObject *argsbuf[2]; PyObject * const *fastargs; Py_ssize_t nargs = PyTuple_GET_SIZE(args); @@ -338,4 +377,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored)) { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=3207dc548c305ad8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b1bde306e2928b19 input=a9049054013a1b77]*/ |