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/binascii.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/binascii.c.h')
-rw-r--r-- | contrib/tools/python3/src/Modules/clinic/binascii.c.h | 624 |
1 files changed, 312 insertions, 312 deletions
diff --git a/contrib/tools/python3/src/Modules/clinic/binascii.c.h b/contrib/tools/python3/src/Modules/clinic/binascii.c.h index 51b465edc8..4d02c72c47 100644 --- a/contrib/tools/python3/src/Modules/clinic/binascii.c.h +++ b/contrib/tools/python3/src/Modules/clinic/binascii.c.h @@ -20,7 +20,7 @@ binascii_a2b_uu(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!ascii_buffer_converter(arg, &data)) { + if (!ascii_buffer_converter(arg, &data)) { goto exit; } return_value = binascii_a2b_uu_impl(module, &data); @@ -40,7 +40,7 @@ PyDoc_STRVAR(binascii_b2a_uu__doc__, "Uuencode line of data."); #define BINASCII_B2A_UU_METHODDEF \ - {"b2a_uu", (PyCFunction)(void(*)(void))binascii_b2a_uu, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_uu__doc__}, + {"b2a_uu", (PyCFunction)(void(*)(void))binascii_b2a_uu, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_uu__doc__}, static PyObject * binascii_b2a_uu_impl(PyObject *module, Py_buffer *data, int backtick); @@ -50,36 +50,36 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj { PyObject *return_value = NULL; static const char * const _keywords[] = {"", "backtick", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "b2a_uu", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {NULL, _keywords, "b2a_uu", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; int backtick = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("b2a_uu", "argument 1", "contiguous buffer", args[0]); - goto exit; - } - if (!noptargs) { - goto skip_optional_kwonly; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - backtick = _PyLong_AsInt(args[1]); - if (backtick == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_kwonly: + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("b2a_uu", "argument 1", "contiguous buffer", args[0]); + goto exit; + } + if (!noptargs) { + goto skip_optional_kwonly; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + backtick = _PyLong_AsInt(args[1]); + if (backtick == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_kwonly: return_value = binascii_b2a_uu_impl(module, &data, backtick); exit: @@ -109,7 +109,7 @@ binascii_a2b_base64(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!ascii_buffer_converter(arg, &data)) { + if (!ascii_buffer_converter(arg, &data)) { goto exit; } return_value = binascii_a2b_base64_impl(module, &data); @@ -129,7 +129,7 @@ PyDoc_STRVAR(binascii_b2a_base64__doc__, "Base64-code line of data."); #define BINASCII_B2A_BASE64_METHODDEF \ - {"b2a_base64", (PyCFunction)(void(*)(void))binascii_b2a_base64, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_base64__doc__}, + {"b2a_base64", (PyCFunction)(void(*)(void))binascii_b2a_base64, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_base64__doc__}, static PyObject * binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline); @@ -139,36 +139,36 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P { PyObject *return_value = NULL; static const char * const _keywords[] = {"", "newline", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "b2a_base64", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {NULL, _keywords, "b2a_base64", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; int newline = 1; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("b2a_base64", "argument 1", "contiguous buffer", args[0]); - goto exit; - } - if (!noptargs) { - goto skip_optional_kwonly; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - newline = _PyLong_AsInt(args[1]); - if (newline == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_kwonly: + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("b2a_base64", "argument 1", "contiguous buffer", args[0]); + goto exit; + } + if (!noptargs) { + goto skip_optional_kwonly; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + newline = _PyLong_AsInt(args[1]); + if (newline == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_kwonly: return_value = binascii_b2a_base64_impl(module, &data, newline); exit: @@ -198,7 +198,7 @@ binascii_a2b_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!ascii_buffer_converter(arg, &data)) { + if (!ascii_buffer_converter(arg, &data)) { goto exit; } return_value = binascii_a2b_hqx_impl(module, &data); @@ -229,13 +229,13 @@ binascii_rlecode_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("rlecode_hqx", "argument", "contiguous buffer", arg); goto exit; } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("rlecode_hqx", "argument", "contiguous buffer", arg); - goto exit; - } return_value = binascii_rlecode_hqx_impl(module, &data); exit: @@ -265,13 +265,13 @@ binascii_b2a_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("b2a_hqx", "argument", "contiguous buffer", arg); goto exit; } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("b2a_hqx", "argument", "contiguous buffer", arg); - goto exit; - } return_value = binascii_b2a_hqx_impl(module, &data); exit: @@ -301,13 +301,13 @@ binascii_rledecode_hqx(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + if (PyObject_GetBuffer(arg, &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("rledecode_hqx", "argument", "contiguous buffer", arg); goto exit; } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("rledecode_hqx", "argument", "contiguous buffer", arg); - goto exit; - } return_value = binascii_rledecode_hqx_impl(module, &data); exit: @@ -326,9 +326,9 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__, "Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ - {"crc_hqx", (PyCFunction)(void(*)(void))binascii_crc_hqx, METH_FASTCALL, binascii_crc_hqx__doc__}, + {"crc_hqx", (PyCFunction)(void(*)(void))binascii_crc_hqx, METH_FASTCALL, binascii_crc_hqx__doc__}, -static PyObject * +static PyObject * binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc); static PyObject * @@ -338,26 +338,26 @@ binascii_crc_hqx(PyObject *module, PyObject *const *args, Py_ssize_t nargs) Py_buffer data = {NULL, NULL}; unsigned int crc; - if (!_PyArg_CheckPositional("crc_hqx", nargs, 2, 2)) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]); - goto exit; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); - if (crc == (unsigned int)-1 && PyErr_Occurred()) { - goto exit; - } - return_value = binascii_crc_hqx_impl(module, &data, crc); + if (!_PyArg_CheckPositional("crc_hqx", nargs, 2, 2)) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]); + goto exit; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); + if (crc == (unsigned int)-1 && PyErr_Occurred()) { + goto exit; + } + return_value = binascii_crc_hqx_impl(module, &data, crc); exit: /* Cleanup for data */ @@ -375,7 +375,7 @@ PyDoc_STRVAR(binascii_crc32__doc__, "Compute CRC-32 incrementally."); #define BINASCII_CRC32_METHODDEF \ - {"crc32", (PyCFunction)(void(*)(void))binascii_crc32, METH_FASTCALL, binascii_crc32__doc__}, + {"crc32", (PyCFunction)(void(*)(void))binascii_crc32, METH_FASTCALL, binascii_crc32__doc__}, static unsigned int binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc); @@ -388,29 +388,29 @@ binascii_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs) unsigned int crc = 0; unsigned int _return_value; - if (!_PyArg_CheckPositional("crc32", nargs, 1, 2)) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("crc32", "argument 1", "contiguous buffer", args[0]); - goto exit; - } - if (nargs < 2) { - goto skip_optional; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); - if (crc == (unsigned int)-1 && PyErr_Occurred()) { - goto exit; - } -skip_optional: + if (!_PyArg_CheckPositional("crc32", nargs, 1, 2)) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("crc32", "argument 1", "contiguous buffer", args[0]); + goto exit; + } + if (nargs < 2) { + goto skip_optional; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); + if (crc == (unsigned int)-1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: _return_value = binascii_crc32_impl(module, &data, crc); if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; @@ -427,78 +427,78 @@ exit: } PyDoc_STRVAR(binascii_b2a_hex__doc__, -"b2a_hex($module, /, data, sep=<unrepresentable>, bytes_per_sep=1)\n" +"b2a_hex($module, /, data, sep=<unrepresentable>, bytes_per_sep=1)\n" "--\n" "\n" "Hexadecimal representation of binary data.\n" "\n" -" sep\n" -" An optional single character or byte to separate hex bytes.\n" -" bytes_per_sep\n" -" How many bytes between separators. Positive values count from the\n" -" right, negative values count from the left.\n" -"\n" +" sep\n" +" An optional single character or byte to separate hex bytes.\n" +" bytes_per_sep\n" +" How many bytes between separators. Positive values count from the\n" +" right, negative values count from the left.\n" +"\n" "The return value is a bytes object. This function is also\n" -"available as \"hexlify()\".\n" -"\n" -"Example:\n" -">>> binascii.b2a_hex(b\'\\xb9\\x01\\xef\')\n" -"b\'b901ef\'\n" -">>> binascii.hexlify(b\'\\xb9\\x01\\xef\', \':\')\n" -"b\'b9:01:ef\'\n" -">>> binascii.b2a_hex(b\'\\xb9\\x01\\xef\', b\'_\', 2)\n" -"b\'b9_01ef\'"); +"available as \"hexlify()\".\n" +"\n" +"Example:\n" +">>> binascii.b2a_hex(b\'\\xb9\\x01\\xef\')\n" +"b\'b901ef\'\n" +">>> binascii.hexlify(b\'\\xb9\\x01\\xef\', \':\')\n" +"b\'b9:01:ef\'\n" +">>> binascii.b2a_hex(b\'\\xb9\\x01\\xef\', b\'_\', 2)\n" +"b\'b9_01ef\'"); #define BINASCII_B2A_HEX_METHODDEF \ - {"b2a_hex", (PyCFunction)(void(*)(void))binascii_b2a_hex, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_hex__doc__}, + {"b2a_hex", (PyCFunction)(void(*)(void))binascii_b2a_hex, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_hex__doc__}, static PyObject * -binascii_b2a_hex_impl(PyObject *module, Py_buffer *data, PyObject *sep, - int bytes_per_sep); +binascii_b2a_hex_impl(PyObject *module, Py_buffer *data, PyObject *sep, + int bytes_per_sep); static PyObject * -binascii_b2a_hex(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +binascii_b2a_hex(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"data", "sep", "bytes_per_sep", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "b2a_hex", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static const char * const _keywords[] = {"data", "sep", "bytes_per_sep", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "b2a_hex", 0}; + PyObject *argsbuf[3]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; - PyObject *sep = NULL; - int bytes_per_sep = 1; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("b2a_hex", "argument 'data'", "contiguous buffer", args[0]); - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - sep = args[1]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - bytes_per_sep = _PyLong_AsInt(args[2]); - if (bytes_per_sep == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: - return_value = binascii_b2a_hex_impl(module, &data, sep, bytes_per_sep); + PyObject *sep = NULL; + int bytes_per_sep = 1; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("b2a_hex", "argument 'data'", "contiguous buffer", args[0]); + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[1]) { + sep = args[1]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + bytes_per_sep = _PyLong_AsInt(args[2]); + if (bytes_per_sep == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: + return_value = binascii_b2a_hex_impl(module, &data, sep, bytes_per_sep); exit: /* Cleanup for data */ @@ -510,70 +510,70 @@ exit: } PyDoc_STRVAR(binascii_hexlify__doc__, -"hexlify($module, /, data, sep=<unrepresentable>, bytes_per_sep=1)\n" +"hexlify($module, /, data, sep=<unrepresentable>, bytes_per_sep=1)\n" "--\n" "\n" "Hexadecimal representation of binary data.\n" "\n" -" sep\n" -" An optional single character or byte to separate hex bytes.\n" -" bytes_per_sep\n" -" How many bytes between separators. Positive values count from the\n" -" right, negative values count from the left.\n" -"\n" -"The return value is a bytes object. This function is also\n" -"available as \"b2a_hex()\"."); +" sep\n" +" An optional single character or byte to separate hex bytes.\n" +" bytes_per_sep\n" +" How many bytes between separators. Positive values count from the\n" +" right, negative values count from the left.\n" +"\n" +"The return value is a bytes object. This function is also\n" +"available as \"b2a_hex()\"."); #define BINASCII_HEXLIFY_METHODDEF \ - {"hexlify", (PyCFunction)(void(*)(void))binascii_hexlify, METH_FASTCALL|METH_KEYWORDS, binascii_hexlify__doc__}, + {"hexlify", (PyCFunction)(void(*)(void))binascii_hexlify, METH_FASTCALL|METH_KEYWORDS, binascii_hexlify__doc__}, static PyObject * -binascii_hexlify_impl(PyObject *module, Py_buffer *data, PyObject *sep, - int bytes_per_sep); +binascii_hexlify_impl(PyObject *module, Py_buffer *data, PyObject *sep, + int bytes_per_sep); static PyObject * -binascii_hexlify(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) +binascii_hexlify(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static const char * const _keywords[] = {"data", "sep", "bytes_per_sep", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "hexlify", 0}; - PyObject *argsbuf[3]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static const char * const _keywords[] = {"data", "sep", "bytes_per_sep", NULL}; + static _PyArg_Parser _parser = {NULL, _keywords, "hexlify", 0}; + PyObject *argsbuf[3]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; - PyObject *sep = NULL; - int bytes_per_sep = 1; - - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("hexlify", "argument 'data'", "contiguous buffer", args[0]); - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - sep = args[1]; - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - bytes_per_sep = _PyLong_AsInt(args[2]); - if (bytes_per_sep == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: - return_value = binascii_hexlify_impl(module, &data, sep, bytes_per_sep); + PyObject *sep = NULL; + int bytes_per_sep = 1; + + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("hexlify", "argument 'data'", "contiguous buffer", args[0]); + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[1]) { + sep = args[1]; + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + bytes_per_sep = _PyLong_AsInt(args[2]); + if (bytes_per_sep == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: + return_value = binascii_hexlify_impl(module, &data, sep, bytes_per_sep); exit: /* Cleanup for data */ @@ -605,7 +605,7 @@ binascii_a2b_hex(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!ascii_buffer_converter(arg, &hexstr)) { + if (!ascii_buffer_converter(arg, &hexstr)) { goto exit; } return_value = binascii_a2b_hex_impl(module, &hexstr); @@ -638,7 +638,7 @@ binascii_unhexlify(PyObject *module, PyObject *arg) PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!ascii_buffer_converter(arg, &hexstr)) { + if (!ascii_buffer_converter(arg, &hexstr)) { goto exit; } return_value = binascii_unhexlify_impl(module, &hexstr); @@ -658,7 +658,7 @@ PyDoc_STRVAR(binascii_a2b_qp__doc__, "Decode a string of qp-encoded data."); #define BINASCII_A2B_QP_METHODDEF \ - {"a2b_qp", (PyCFunction)(void(*)(void))binascii_a2b_qp, METH_FASTCALL|METH_KEYWORDS, binascii_a2b_qp__doc__}, + {"a2b_qp", (PyCFunction)(void(*)(void))binascii_a2b_qp, METH_FASTCALL|METH_KEYWORDS, binascii_a2b_qp__doc__}, static PyObject * binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header); @@ -668,32 +668,32 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj { PyObject *return_value = NULL; static const char * const _keywords[] = {"data", "header", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "a2b_qp", 0}; - PyObject *argsbuf[2]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {NULL, _keywords, "a2b_qp", 0}; + PyObject *argsbuf[2]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; int header = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); - if (!args) { - goto exit; - } - if (!ascii_buffer_converter(args[0], &data)) { - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - header = _PyLong_AsInt(args[1]); - if (header == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); + if (!args) { + goto exit; + } + if (!ascii_buffer_converter(args[0], &data)) { + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + header = _PyLong_AsInt(args[1]); + if (header == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: return_value = binascii_a2b_qp_impl(module, &data, header); exit: @@ -715,7 +715,7 @@ PyDoc_STRVAR(binascii_b2a_qp__doc__, "are both encoded. When quotetabs is set, space and tabs are encoded."); #define BINASCII_B2A_QP_METHODDEF \ - {"b2a_qp", (PyCFunction)(void(*)(void))binascii_b2a_qp, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_qp__doc__}, + {"b2a_qp", (PyCFunction)(void(*)(void))binascii_b2a_qp, METH_FASTCALL|METH_KEYWORDS, binascii_b2a_qp__doc__}, static PyObject * binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs, @@ -726,66 +726,66 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj { PyObject *return_value = NULL; static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL}; - static _PyArg_Parser _parser = {NULL, _keywords, "b2a_qp", 0}; - PyObject *argsbuf[4]; - Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; + static _PyArg_Parser _parser = {NULL, _keywords, "b2a_qp", 0}; + PyObject *argsbuf[4]; + Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1; Py_buffer data = {NULL, NULL}; int quotetabs = 0; int istext = 1; int header = 0; - args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); - if (!args) { - goto exit; - } - if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { - goto exit; - } - if (!PyBuffer_IsContiguous(&data, 'C')) { - _PyArg_BadArgument("b2a_qp", "argument 'data'", "contiguous buffer", args[0]); - goto exit; - } - if (!noptargs) { - goto skip_optional_pos; - } - if (args[1]) { - if (PyFloat_Check(args[1])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - quotetabs = _PyLong_AsInt(args[1]); - if (quotetabs == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (args[2]) { - if (PyFloat_Check(args[2])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - istext = _PyLong_AsInt(args[2]); - if (istext == -1 && PyErr_Occurred()) { - goto exit; - } - if (!--noptargs) { - goto skip_optional_pos; - } - } - if (PyFloat_Check(args[3])) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float" ); - goto exit; - } - header = _PyLong_AsInt(args[3]); - if (header == -1 && PyErr_Occurred()) { - goto exit; - } -skip_optional_pos: + args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 4, 0, argsbuf); + if (!args) { + goto exit; + } + if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) { + goto exit; + } + if (!PyBuffer_IsContiguous(&data, 'C')) { + _PyArg_BadArgument("b2a_qp", "argument 'data'", "contiguous buffer", args[0]); + goto exit; + } + if (!noptargs) { + goto skip_optional_pos; + } + if (args[1]) { + if (PyFloat_Check(args[1])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + quotetabs = _PyLong_AsInt(args[1]); + if (quotetabs == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (args[2]) { + if (PyFloat_Check(args[2])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + istext = _PyLong_AsInt(args[2]); + if (istext == -1 && PyErr_Occurred()) { + goto exit; + } + if (!--noptargs) { + goto skip_optional_pos; + } + } + if (PyFloat_Check(args[3])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + header = _PyLong_AsInt(args[3]); + if (header == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional_pos: return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header); exit: @@ -796,4 +796,4 @@ exit: return return_value; } -/*[clinic end generated code: output=a1e878d3963b615e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a1e878d3963b615e input=a9049054013a1b77]*/ |