diff options
author | Erlend E. Aasland <erlend.aasland@protonmail.com> | 2022-08-13 10:09:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-13 10:09:40 (GMT) |
commit | f07adf82f338ebb7e69475537be050e63c2009fa (patch) | |
tree | 26c4cd000b95fc45befb2ea3c87c03d84d9aed75 /Modules/clinic/_gdbmmodule.c.h | |
parent | f235178beccf5eb5b47e770240f32d9ba24b26fd (diff) | |
download | cpython-f07adf82f338ebb7e69475537be050e63c2009fa.zip cpython-f07adf82f338ebb7e69475537be050e63c2009fa.tar.gz cpython-f07adf82f338ebb7e69475537be050e63c2009fa.tar.bz2 |
gh-90928: Improve static initialization of keywords tuple in AC (#95907)
Diffstat (limited to 'Modules/clinic/_gdbmmodule.c.h')
-rw-r--r-- | Modules/clinic/_gdbmmodule.c.h | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h index ca1bfde..5c6aeee 100644 --- a/Modules/clinic/_gdbmmodule.c.h +++ b/Modules/clinic/_gdbmmodule.c.h @@ -168,33 +168,11 @@ static PyObject * _gdbm_gdbm_nextkey(gdbmobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - #define NUM_KEYWORDS 0 - #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 = { }, - }; - # 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 + #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) + # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) + #else + # define KWTUPLE NULL + #endif static const char * const _keywords[] = {"", NULL}; static _PyArg_Parser _parser = { @@ -344,4 +322,4 @@ skip_optional: exit: return return_value; } -/*[clinic end generated code: output=72d3e46432e2d324 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c6e721d82335adb3 input=a9049054013a1b77]*/ |