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/Modules/clinic/_gdbmmodule.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/Modules/clinic/_gdbmmodule.c.h')
-rw-r--r-- | contrib/tools/python3/src/Modules/clinic/_gdbmmodule.c.h | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/contrib/tools/python3/src/Modules/clinic/_gdbmmodule.c.h b/contrib/tools/python3/src/Modules/clinic/_gdbmmodule.c.h index 473cd98027..552bf6ed88 100644 --- a/contrib/tools/python3/src/Modules/clinic/_gdbmmodule.c.h +++ b/contrib/tools/python3/src/Modules/clinic/_gdbmmodule.c.h @@ -9,7 +9,7 @@ PyDoc_STRVAR(_gdbm_gdbm_get__doc__, "Get the value for key, or default if not present."); #define _GDBM_GDBM_GET_METHODDEF \ - {"get", (PyCFunction)(void(*)(void))_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__}, + {"get", (PyCFunction)(void(*)(void))_gdbm_gdbm_get, METH_FASTCALL, _gdbm_gdbm_get__doc__}, static PyObject * _gdbm_gdbm_get_impl(dbmobject *self, PyObject *key, PyObject *default_value); @@ -21,15 +21,15 @@ _gdbm_gdbm_get(dbmobject *self, PyObject *const *args, Py_ssize_t nargs) PyObject *key; PyObject *default_value = Py_None; - if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("get", nargs, 1, 2)) { goto exit; } - key = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: + key = args[0]; + if (nargs < 2) { + goto skip_optional; + } + default_value = args[1]; +skip_optional: return_value = _gdbm_gdbm_get_impl(self, key, default_value); exit: @@ -43,7 +43,7 @@ PyDoc_STRVAR(_gdbm_gdbm_setdefault__doc__, "Get value for key, or set it to default and return default if not present."); #define _GDBM_GDBM_SETDEFAULT_METHODDEF \ - {"setdefault", (PyCFunction)(void(*)(void))_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__}, + {"setdefault", (PyCFunction)(void(*)(void))_gdbm_gdbm_setdefault, METH_FASTCALL, _gdbm_gdbm_setdefault__doc__}, static PyObject * _gdbm_gdbm_setdefault_impl(dbmobject *self, PyObject *key, @@ -56,15 +56,15 @@ _gdbm_gdbm_setdefault(dbmobject *self, PyObject *const *args, Py_ssize_t nargs) PyObject *key; PyObject *default_value = Py_None; - if (!_PyArg_CheckPositional("setdefault", nargs, 1, 2)) { + if (!_PyArg_CheckPositional("setdefault", nargs, 1, 2)) { goto exit; } - key = args[0]; - if (nargs < 2) { - goto skip_optional; - } - default_value = args[1]; -skip_optional: + key = args[0]; + if (nargs < 2) { + goto skip_optional; + } + default_value = args[1]; +skip_optional: return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value); exit: @@ -139,7 +139,7 @@ PyDoc_STRVAR(_gdbm_gdbm_nextkey__doc__, "to create a list in memory that contains them all:\n" "\n" " k = db.firstkey()\n" -" while k is not None:\n" +" while k is not None:\n" " print(k)\n" " k = db.nextkey(k)"); @@ -239,7 +239,7 @@ PyDoc_STRVAR(dbmopen__doc__, "when the database has to be created. It defaults to octal 0o666."); #define DBMOPEN_METHODDEF \ - {"open", (PyCFunction)(void(*)(void))dbmopen, METH_FASTCALL, dbmopen__doc__}, + {"open", (PyCFunction)(void(*)(void))dbmopen, METH_FASTCALL, dbmopen__doc__}, static PyObject * dbmopen_impl(PyObject *module, PyObject *filename, const char *flags, @@ -253,49 +253,49 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs) const char *flags = "r"; int mode = 438; - if (!_PyArg_CheckPositional("open", nargs, 1, 3)) { + if (!_PyArg_CheckPositional("open", nargs, 1, 3)) { + goto exit; + } + if (!PyUnicode_Check(args[0])) { + _PyArg_BadArgument("open", "argument 1", "str", args[0]); + goto exit; + } + if (PyUnicode_READY(args[0]) == -1) { + goto exit; + } + filename = args[0]; + if (nargs < 2) { + goto skip_optional; + } + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("open", "argument 2", "str", args[1]); + goto exit; + } + Py_ssize_t flags_length; + flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length); + if (flags == NULL) { + goto exit; + } + if (strlen(flags) != (size_t)flags_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + if (nargs < 3) { + goto skip_optional; + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + mode = _PyLong_AsInt(args[2]); + if (mode == -1 && PyErr_Occurred()) { goto exit; } - if (!PyUnicode_Check(args[0])) { - _PyArg_BadArgument("open", "argument 1", "str", args[0]); - goto exit; - } - if (PyUnicode_READY(args[0]) == -1) { - goto exit; - } - filename = args[0]; - if (nargs < 2) { - goto skip_optional; - } - if (!PyUnicode_Check(args[1])) { - _PyArg_BadArgument("open", "argument 2", "str", args[1]); - goto exit; - } - Py_ssize_t flags_length; - flags = PyUnicode_AsUTF8AndSize(args[1], &flags_length); - if (flags == NULL) { - goto exit; - } - if (strlen(flags) != (size_t)flags_length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - goto exit; - } - if (nargs < 3) { - goto skip_optional; - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - mode = _PyLong_AsInt(args[2]); - if (mode == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: +skip_optional: return_value = dbmopen_impl(module, filename, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=f48d6e8d4c8a3465 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f48d6e8d4c8a3465 input=a9049054013a1b77]*/ |