summaryrefslogtreecommitdiff
path: root/Modules/_io/clinic/_iomodule.c.h
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend.aasland@protonmail.com>2022-08-13 12:09:40 +0200
committerGitHub <noreply@github.com>2022-08-13 12:09:40 +0200
commitf07adf82f338ebb7e69475537be050e63c2009fa (patch)
tree26c4cd000b95fc45befb2ea3c87c03d84d9aed75 /Modules/_io/clinic/_iomodule.c.h
parentf235178beccf5eb5b47e770240f32d9ba24b26fd (diff)
downloadcpython-git-f07adf82f338ebb7e69475537be050e63c2009fa.tar.gz
gh-90928: Improve static initialization of keywords tuple in AC (#95907)
Diffstat (limited to 'Modules/_io/clinic/_iomodule.c.h')
-rw-r--r--Modules/_io/clinic/_iomodule.c.h50
1 files changed, 15 insertions, 35 deletions
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index 470b0cb08e..b38738486f 100644
--- a/Modules/_io/clinic/_iomodule.c.h
+++ b/Modules/_io/clinic/_iomodule.c.h
@@ -139,18 +139,9 @@ static PyObject *
_io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
- #define NUM_KEYWORDS 8
- #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 8
static struct {
PyGC_Head _this_is_not_used;
PyObject_VAR_HEAD
@@ -159,13 +150,12 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_item = { &_Py_ID(file), &_Py_ID(mode), &_Py_ID(buffering), &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(newline), &_Py_ID(closefd), &_Py_ID(opener), },
};
- # 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[] = {"file", "mode", "buffering", "encoding", "errors", "newline", "closefd", "opener", NULL};
static _PyArg_Parser _parser = {
@@ -372,18 +362,9 @@ static PyObject *
_io_open_code(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
@@ -392,13 +373,12 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_item = { &_Py_ID(path), },
};
- # 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[] = {"path", NULL};
static _PyArg_Parser _parser = {
@@ -427,4 +407,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
-/*[clinic end generated code: output=ea13625ef5c1c5ef input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1f8001287a423470 input=a9049054013a1b77]*/