diff options
Diffstat (limited to 'Modules/clinic/_codecsmodule.c.h')
-rw-r--r-- | Modules/clinic/_codecsmodule.c.h | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h index 29e9d5e..be8b11a 100644 --- a/Modules/clinic/_codecsmodule.c.h +++ b/Modules/clinic/_codecsmodule.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(_codecs_register__doc__, "register($module, search_function, /)\n" "--\n" @@ -86,8 +92,41 @@ static PyObject * _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; + #define NUM_KEYWORDS 3 + #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(obj), &_Py_ID(encoding), &_Py_ID(errors), }, + }; + # 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[] = {"obj", "encoding", "errors", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "encode", 0}; + static _PyArg_Parser _parser = { + .keywords = _keywords, + .fname = "encode", + .kwtuple = KWTUPLE, + }; + #undef KWTUPLE PyObject *argsbuf[3]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *obj; @@ -163,8 +202,41 @@ static PyObject * _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; + #define NUM_KEYWORDS 3 + #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(obj), &_Py_ID(encoding), &_Py_ID(errors), }, + }; + # 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[] = {"obj", "encoding", "errors", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "decode", 0}; + static _PyArg_Parser _parser = { + .keywords = _keywords, + .fname = "decode", + .kwtuple = KWTUPLE, + }; + #undef KWTUPLE PyObject *argsbuf[3]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; PyObject *obj; @@ -2817,4 +2889,4 @@ exit: #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ -/*[clinic end generated code: output=92250568c3a6f0a0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=58003a0c706e89c2 input=a9049054013a1b77]*/ |