summaryrefslogtreecommitdiff
path: root/Objects/clinic/memoryobject.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/clinic/memoryobject.c.h')
-rw-r--r--Objects/clinic/memoryobject.c.h148
1 files changed, 143 insertions, 5 deletions
diff --git a/Objects/clinic/memoryobject.c.h b/Objects/clinic/memoryobject.c.h
index 73ef8d143b..dd21cf6f1c 100644
--- a/Objects/clinic/memoryobject.c.h
+++ b/Objects/clinic/memoryobject.c.h
@@ -2,6 +2,12 @@
preserve
[clinic start generated code]*/
+#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+# include "pycore_gc.h" // PyGC_Head
+# include "pycore_runtime.h" // _Py_ID()
+#endif
+
+
PyDoc_STRVAR(memoryview__doc__,
"memoryview(object)\n"
"--\n"
@@ -15,8 +21,41 @@ static PyObject *
memoryview(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
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)
+
+ static struct {
+ PyGC_Head _this_is_not_used;
+ PyObject_VAR_HEAD
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_item = { &_Py_ID(object), },
+ };
+ # 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
+
static const char * const _keywords[] = {"object", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "memoryview", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "memoryview",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[1];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
@@ -68,8 +107,41 @@ static PyObject *
memoryview_cast(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ #define NUM_KEYWORDS 2
+ #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
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_item = { &_Py_ID(format), &_Py_ID(shape), },
+ };
+ # 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
+
static const char * const _keywords[] = {"format", "shape", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "cast", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "cast",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *format;
@@ -156,8 +228,41 @@ static PyObject *
memoryview_tobytes(PyMemoryViewObject *self, 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)
+
+ static struct {
+ PyGC_Head _this_is_not_used;
+ PyObject_VAR_HEAD
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_item = { &_Py_ID(order), },
+ };
+ # 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
+
static const char * const _keywords[] = {"order", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "tobytes", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "tobytes",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[1];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
const char *order = NULL;
@@ -228,8 +333,41 @@ static PyObject *
memoryview_hex(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ #define NUM_KEYWORDS 2
+ #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
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_item = { &_Py_ID(sep), &_Py_ID(bytes_per_sep), },
+ };
+ # 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
+
static const char * const _keywords[] = {"sep", "bytes_per_sep", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "hex", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "hex",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[2];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
PyObject *sep = NULL;
@@ -258,4 +396,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=48be570b5e6038e3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9617628ea080c887 input=a9049054013a1b77]*/