gh-90928: Improve static initialization of keywords tuple in AC (#95907)

This commit is contained in:
Erlend E. Aasland 2022-08-13 12:09:40 +02:00 committed by GitHub
parent f235178bec
commit f07adf82f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 2746 additions and 6797 deletions

View file

@ -23,18 +23,9 @@ static PyObject *
_ssl_Certificate_public_bytes(PySSLCertificate *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
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
@ -43,13 +34,12 @@ _ssl_Certificate_public_bytes(PySSLCertificate *self, PyObject *const *args, Py_
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
.ob_item = { &_Py_ID(format), },
};
# 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[] = {"format", NULL};
static _PyArg_Parser _parser = {
@ -96,4 +86,4 @@ _ssl_Certificate_get_info(PySSLCertificate *self, PyObject *Py_UNUSED(ignored))
{
return _ssl_Certificate_get_info_impl(self);
}
/*[clinic end generated code: output=39d0c03e76b5f361 input=a9049054013a1b77]*/
/*[clinic end generated code: output=82efada014f9b7fe input=a9049054013a1b77]*/