aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/clinic/_pickle.c.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-12 07:53:52 +0300
committerDaniil Cherednik <dcherednik@ydb.tech>2024-02-14 14:26:16 +0000
commit31f2a419764a8ba77c2a970cfc80056c6cd06756 (patch)
treec1995d239eba8571cefc640f6648e1d5dd4ce9e2 /contrib/tools/python3/src/Modules/clinic/_pickle.c.h
parentfe2ef02b38d9c85d80060963b265a1df9f38c3bb (diff)
downloadydb-31f2a419764a8ba77c2a970cfc80056c6cd06756.tar.gz
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Modules/clinic/_pickle.c.h')
-rw-r--r--contrib/tools/python3/src/Modules/clinic/_pickle.c.h248
1 files changed, 223 insertions, 25 deletions
diff --git a/contrib/tools/python3/src/Modules/clinic/_pickle.c.h b/contrib/tools/python3/src/Modules/clinic/_pickle.c.h
index 5dc62fe190..b39c04dcaa 100644
--- a/contrib/tools/python3/src/Modules/clinic/_pickle.c.h
+++ b/contrib/tools/python3/src/Modules/clinic/_pickle.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(_pickle_Pickler_clear_memo__doc__,
"clear_memo($self, /)\n"
"--\n"
@@ -32,7 +38,42 @@ PyDoc_STRVAR(_pickle_Pickler_dump__doc__,
"Write a pickled representation of the given object to the open file.");
#define _PICKLE_PICKLER_DUMP_METHODDEF \
- {"dump", (PyCFunction)_pickle_Pickler_dump, METH_O, _pickle_Pickler_dump__doc__},
+ {"dump", _PyCFunction_CAST(_pickle_Pickler_dump), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _pickle_Pickler_dump__doc__},
+
+static PyObject *
+_pickle_Pickler_dump_impl(PicklerObject *self, PyTypeObject *cls,
+ PyObject *obj);
+
+static PyObject *
+_pickle_Pickler_dump(PicklerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
+ # define KWTUPLE NULL
+ #endif
+
+ static const char * const _keywords[] = {"", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "dump",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[1];
+ PyObject *obj;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ obj = args[0];
+ return_value = _pickle_Pickler_dump_impl(self, cls, obj);
+
+exit:
+ return return_value;
+}
PyDoc_STRVAR(_pickle_Pickler___sizeof____doc__,
"__sizeof__($self, /)\n"
@@ -43,20 +84,20 @@ PyDoc_STRVAR(_pickle_Pickler___sizeof____doc__,
#define _PICKLE_PICKLER___SIZEOF___METHODDEF \
{"__sizeof__", (PyCFunction)_pickle_Pickler___sizeof__, METH_NOARGS, _pickle_Pickler___sizeof____doc__},
-static Py_ssize_t
+static size_t
_pickle_Pickler___sizeof___impl(PicklerObject *self);
static PyObject *
_pickle_Pickler___sizeof__(PicklerObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
- Py_ssize_t _return_value;
+ size_t _return_value;
_return_value = _pickle_Pickler___sizeof___impl(self);
- if ((_return_value == -1) && PyErr_Occurred()) {
+ if ((_return_value == (size_t)-1) && PyErr_Occurred()) {
goto exit;
}
- return_value = PyLong_FromSsize_t(_return_value);
+ return_value = PyLong_FromSize_t(_return_value);
exit:
return return_value;
@@ -106,8 +147,31 @@ static int
_pickle_Pickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
+ #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
+ PyObject *ob_item[NUM_KEYWORDS];
+ } _kwtuple = {
+ .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
+ .ob_item = { &_Py_ID(file), &_Py_ID(protocol), &_Py_ID(fix_imports), &_Py_ID(buffer_callback), },
+ };
+ #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", "protocol", "fix_imports", "buffer_callback", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "Pickler", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "Pickler",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[4];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
@@ -213,15 +277,19 @@ PyDoc_STRVAR(_pickle_Unpickler_load__doc__,
"specified therein.");
#define _PICKLE_UNPICKLER_LOAD_METHODDEF \
- {"load", (PyCFunction)_pickle_Unpickler_load, METH_NOARGS, _pickle_Unpickler_load__doc__},
+ {"load", _PyCFunction_CAST(_pickle_Unpickler_load), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _pickle_Unpickler_load__doc__},
static PyObject *
-_pickle_Unpickler_load_impl(UnpicklerObject *self);
+_pickle_Unpickler_load_impl(UnpicklerObject *self, PyTypeObject *cls);
static PyObject *
-_pickle_Unpickler_load(UnpicklerObject *self, PyObject *Py_UNUSED(ignored))
+_pickle_Unpickler_load(UnpicklerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
- return _pickle_Unpickler_load_impl(self);
+ if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
+ PyErr_SetString(PyExc_TypeError, "load() takes no arguments");
+ return NULL;
+ }
+ return _pickle_Unpickler_load_impl(self, cls);
}
PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__,
@@ -238,26 +306,41 @@ PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__,
"needed. Both arguments passed are str objects.");
#define _PICKLE_UNPICKLER_FIND_CLASS_METHODDEF \
- {"find_class", _PyCFunction_CAST(_pickle_Unpickler_find_class), METH_FASTCALL, _pickle_Unpickler_find_class__doc__},
+ {"find_class", _PyCFunction_CAST(_pickle_Unpickler_find_class), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _pickle_Unpickler_find_class__doc__},
static PyObject *
-_pickle_Unpickler_find_class_impl(UnpicklerObject *self,
+_pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyTypeObject *cls,
PyObject *module_name,
PyObject *global_name);
static PyObject *
-_pickle_Unpickler_find_class(UnpicklerObject *self, PyObject *const *args, Py_ssize_t nargs)
+_pickle_Unpickler_find_class(UnpicklerObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
PyObject *return_value = NULL;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
+ # define KWTUPLE NULL
+ #endif
+
+ static const char * const _keywords[] = {"", "", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "find_class",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[2];
PyObject *module_name;
PyObject *global_name;
- if (!_PyArg_CheckPositional("find_class", nargs, 2, 2)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
goto exit;
}
module_name = args[0];
global_name = args[1];
- return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name);
+ return_value = _pickle_Unpickler_find_class_impl(self, cls, module_name, global_name);
exit:
return return_value;
@@ -272,20 +355,20 @@ PyDoc_STRVAR(_pickle_Unpickler___sizeof____doc__,
#define _PICKLE_UNPICKLER___SIZEOF___METHODDEF \
{"__sizeof__", (PyCFunction)_pickle_Unpickler___sizeof__, METH_NOARGS, _pickle_Unpickler___sizeof____doc__},
-static Py_ssize_t
+static size_t
_pickle_Unpickler___sizeof___impl(UnpicklerObject *self);
static PyObject *
_pickle_Unpickler___sizeof__(UnpicklerObject *self, PyObject *Py_UNUSED(ignored))
{
PyObject *return_value = NULL;
- Py_ssize_t _return_value;
+ size_t _return_value;
_return_value = _pickle_Unpickler___sizeof___impl(self);
- if ((_return_value == -1) && PyErr_Occurred()) {
+ if ((_return_value == (size_t)-1) && PyErr_Occurred()) {
goto exit;
}
- return_value = PyLong_FromSsize_t(_return_value);
+ return_value = PyLong_FromSize_t(_return_value);
exit:
return return_value;
@@ -326,8 +409,31 @@ static int
_pickle_Unpickler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+
+ #define NUM_KEYWORDS 5
+ 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(file), &_Py_ID(fix_imports), &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(buffers), },
+ };
+ #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", "fix_imports", "encoding", "errors", "buffers", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "Unpickler", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "Unpickler",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[5];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
@@ -497,8 +603,31 @@ static PyObject *
_pickle_dump(PyObject *module, 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 5
+ 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(obj), &_Py_ID(file), &_Py_ID(protocol), &_Py_ID(fix_imports), &_Py_ID(buffer_callback), },
+ };
+ #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[] = {"obj", "file", "protocol", "fix_imports", "buffer_callback", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "dump", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "dump",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2;
PyObject *obj;
@@ -578,8 +707,31 @@ static PyObject *
_pickle_dumps(PyObject *module, 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 4
+ 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(obj), &_Py_ID(protocol), &_Py_ID(fix_imports), &_Py_ID(buffer_callback), },
+ };
+ #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[] = {"obj", "protocol", "fix_imports", "buffer_callback", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "dumps", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "dumps",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[4];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *obj;
@@ -663,8 +815,31 @@ static PyObject *
_pickle_load(PyObject *module, 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 5
+ 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(file), &_Py_ID(fix_imports), &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(buffers), },
+ };
+ #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", "fix_imports", "encoding", "errors", "buffers", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "load", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "load",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *file;
@@ -766,8 +941,31 @@ static PyObject *
_pickle_loads(PyObject *module, 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 4
+ 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(fix_imports), &_Py_ID(encoding), &_Py_ID(errors), &_Py_ID(buffers), },
+ };
+ #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[] = {"", "fix_imports", "encoding", "errors", "buffers", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "loads", 0};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "loads",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
PyObject *argsbuf[5];
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
PyObject *data;
@@ -836,4 +1034,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=1bb1ead3c828e108 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5886b563df7b866d input=a9049054013a1b77]*/