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 /Python/clinic/traceback.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 'Python/clinic/traceback.c.h')
-rw-r--r-- | Python/clinic/traceback.c.h | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/Python/clinic/traceback.c.h b/Python/clinic/traceback.c.h index 5de1102..3c34493 100644 --- a/Python/clinic/traceback.c.h +++ b/Python/clinic/traceback.c.h @@ -22,18 +22,9 @@ static PyObject * tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - #define NUM_KEYWORDS 4 - #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 4 static struct { PyGC_Head _this_is_not_used; PyObject_VAR_HEAD @@ -42,13 +33,12 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) .ob_item = { &_Py_ID(tb_next), &_Py_ID(tb_frame), &_Py_ID(tb_lasti), &_Py_ID(tb_lineno), }, }; - # 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[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL}; static _PyArg_Parser _parser = { @@ -88,4 +78,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=130ba2a638849c70 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7bc9927e362fdfb7 input=a9049054013a1b77]*/ |