diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Python/clinic/marshal.c.h | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/clinic/marshal.c.h')
-rw-r--r-- | contrib/tools/python3/src/Python/clinic/marshal.c.h | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/tools/python3/src/Python/clinic/marshal.c.h b/contrib/tools/python3/src/Python/clinic/marshal.c.h index 9064651287..05d4830c4a 100644 --- a/contrib/tools/python3/src/Python/clinic/marshal.c.h +++ b/contrib/tools/python3/src/Python/clinic/marshal.c.h @@ -20,7 +20,7 @@ PyDoc_STRVAR(marshal_dump__doc__, "to the file. The object will not be properly read back by load()."); #define MARSHAL_DUMP_METHODDEF \ - {"dump", (PyCFunction)(void(*)(void))marshal_dump, METH_FASTCALL, marshal_dump__doc__}, + {"dump", (PyCFunction)(void(*)(void))marshal_dump, METH_FASTCALL, marshal_dump__doc__}, static PyObject * marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, @@ -34,24 +34,24 @@ marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *file; int version = Py_MARSHAL_VERSION; - if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { + if (!_PyArg_CheckPositional("dump", nargs, 2, 3)) { goto exit; } - value = args[0]; - file = args[1]; - if (nargs < 3) { - goto skip_optional; - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - version = _PyLong_AsInt(args[2]); - if (version == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: + value = args[0]; + file = args[1]; + if (nargs < 3) { + goto skip_optional; + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + version = _PyLong_AsInt(args[2]); + if (version == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: return_value = marshal_dump_impl(module, value, file, version); exit: @@ -92,7 +92,7 @@ PyDoc_STRVAR(marshal_dumps__doc__, "unsupported type."); #define MARSHAL_DUMPS_METHODDEF \ - {"dumps", (PyCFunction)(void(*)(void))marshal_dumps, METH_FASTCALL, marshal_dumps__doc__}, + {"dumps", (PyCFunction)(void(*)(void))marshal_dumps, METH_FASTCALL, marshal_dumps__doc__}, static PyObject * marshal_dumps_impl(PyObject *module, PyObject *value, int version); @@ -104,23 +104,23 @@ marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs) PyObject *value; int version = Py_MARSHAL_VERSION; - if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("dumps", nargs, 1, 2)) { + goto exit; + } + value = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + version = _PyLong_AsInt(args[1]); + if (version == -1 && PyErr_Occurred()) { goto exit; } - value = args[0]; - if (nargs < 2) { - goto skip_optional; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - version = _PyLong_AsInt(args[1]); - if (version == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: +skip_optional: return_value = marshal_dumps_impl(module, value, version); exit: @@ -148,13 +148,13 @@ marshal_loads(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer bytes = {NULL, NULL}; - if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) { + if (PyObject_GetBuffer(arg, &bytes, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&bytes, 'C')) { + _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg); goto exit; } - if (!PyBuffer_IsContiguous(&bytes, 'C')) { - _PyArg_BadArgument("loads", "argument", "contiguous buffer", arg); - goto exit; - } return_value = marshal_loads_impl(module, &bytes); exit: @@ -165,4 +165,4 @@ exit: return return_value; } -/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/ |