summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/gcmodule.c.h
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend.aasland@protonmail.com>2022-08-13 10:09:40 (GMT)
committerGitHub <noreply@github.com>2022-08-13 10:09:40 (GMT)
commitf07adf82f338ebb7e69475537be050e63c2009fa (patch)
tree26c4cd000b95fc45befb2ea3c87c03d84d9aed75 /Modules/clinic/gcmodule.c.h
parentf235178beccf5eb5b47e770240f32d9ba24b26fd (diff)
downloadcpython-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/gcmodule.c.h')
-rw-r--r--Modules/clinic/gcmodule.c.h50
1 files changed, 15 insertions, 35 deletions
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h
index af04398..2d18e2e 100644
--- a/Modules/clinic/gcmodule.c.h
+++ b/Modules/clinic/gcmodule.c.h
@@ -94,18 +94,9 @@ static PyObject *
gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- #define NUM_KEYWORDS 1
- #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)
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ #define NUM_KEYWORDS 1
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
@@ -114,13 +105,12 @@ gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_item = { &_Py_ID(generation), },
};
- # 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
+ #define KWTUPLE (&_kwtuple.ob_base.ob_base)
+
+ #else // !Py_BUILD_CORE
+ # define KWTUPLE NULL
+ #endif // !Py_BUILD_CORE
static const char * const _keywords[] = {"generation", NULL};
static _PyArg_Parser _parser = {
@@ -281,18 +271,9 @@ static PyObject *
gc_get_objects(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- #define NUM_KEYWORDS 1
- #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)
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ #define NUM_KEYWORDS 1
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
@@ -301,13 +282,12 @@ gc_get_objects(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_item = { &_Py_ID(generation), },
};
- # 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
+ #define KWTUPLE (&_kwtuple.ob_base.ob_base)
+
+ #else // !Py_BUILD_CORE
+ # define KWTUPLE NULL
+ #endif // !Py_BUILD_CORE
static const char * const _keywords[] = {"generation", NULL};
static _PyArg_Parser _parser = {
@@ -444,4 +424,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=8c73502d349c8726 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=66432ac0e17fd04f input=a9049054013a1b77]*/