mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-90928: Improve static initialization of keywords tuple in AC (#95907)
This commit is contained in:
parent
f235178bec
commit
f07adf82f3
81 changed files with 2746 additions and 6797 deletions
26
Python/clinic/Python-tokenize.c.h
generated
26
Python/clinic/Python-tokenize.c.h
generated
|
@ -15,18 +15,9 @@ static PyObject *
|
|||
tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#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)
|
||||
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
|
@ -35,13 +26,12 @@ tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(source), },
|
||||
};
|
||||
# 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[] = {"source", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
|
@ -77,4 +67,4 @@ tokenizeriter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=5664c98597aec79e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=8c2c09f651961986 input=a9049054013a1b77]*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue