summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/binascii.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/binascii.c.h')
-rw-r--r--Modules/clinic/binascii.c.h99
1 files changed, 65 insertions, 34 deletions
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index e20cac2..68c34f9 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -20,8 +20,9 @@ binascii_a2b_uu(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) {
goto exit;
+ }
return_value = binascii_a2b_uu_impl(module, &data);
exit:
@@ -50,14 +51,16 @@ binascii_b2a_uu(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_uu", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) {
goto exit;
+ }
return_value = binascii_b2a_uu_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -80,8 +83,9 @@ binascii_a2b_base64(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) {
goto exit;
+ }
return_value = binascii_a2b_base64_impl(module, &data);
exit:
@@ -93,31 +97,36 @@ exit:
}
PyDoc_STRVAR(binascii_b2a_base64__doc__,
-"b2a_base64($module, data, /)\n"
+"b2a_base64($module, /, data, *, newline=True)\n"
"--\n"
"\n"
"Base64-code line of data.");
#define BINASCII_B2A_BASE64_METHODDEF \
- {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_O, binascii_b2a_base64__doc__},
+ {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_VARARGS|METH_KEYWORDS, binascii_b2a_base64__doc__},
static PyObject *
-binascii_b2a_base64_impl(PyObject *module, Py_buffer *data);
+binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline);
static PyObject *
-binascii_b2a_base64(PyObject *module, PyObject *arg)
+binascii_b2a_base64(PyObject *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
+ static char *_keywords[] = {"data", "newline", NULL};
Py_buffer data = {NULL, NULL};
+ int newline = 1;
- if (!PyArg_Parse(arg, "y*:b2a_base64", &data))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|$i:b2a_base64", _keywords,
+ &data, &newline)) {
goto exit;
- return_value = binascii_b2a_base64_impl(module, &data);
+ }
+ return_value = binascii_b2a_base64_impl(module, &data, newline);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -140,8 +149,9 @@ binascii_a2b_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data))
+ if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) {
goto exit;
+ }
return_value = binascii_a2b_hqx_impl(module, &data);
exit:
@@ -170,14 +180,16 @@ binascii_rlecode_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) {
goto exit;
+ }
return_value = binascii_rlecode_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -200,14 +212,16 @@ binascii_b2a_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) {
goto exit;
+ }
return_value = binascii_b2a_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -230,14 +244,16 @@ binascii_rledecode_hqx(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data))
+ if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) {
goto exit;
+ }
return_value = binascii_rledecode_hqx_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -263,17 +279,20 @@ binascii_crc_hqx(PyObject *module, PyObject *args)
unsigned int _return_value;
if (!PyArg_ParseTuple(args, "y*I:crc_hqx",
- &data, &crc))
+ &data, &crc)) {
goto exit;
+ }
_return_value = binascii_crc_hqx_impl(module, &data, crc);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -299,17 +318,20 @@ binascii_crc32(PyObject *module, PyObject *args)
unsigned int _return_value;
if (!PyArg_ParseTuple(args, "y*|I:crc32",
- &data, &crc))
+ &data, &crc)) {
goto exit;
+ }
_return_value = binascii_crc32_impl(module, &data, crc);
- if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
goto exit;
+ }
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -335,14 +357,16 @@ binascii_b2a_hex(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:b2a_hex", &data))
+ if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) {
goto exit;
+ }
return_value = binascii_b2a_hex_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -367,14 +391,16 @@ binascii_hexlify(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- if (!PyArg_Parse(arg, "y*:hexlify", &data))
+ if (!PyArg_Parse(arg, "y*:hexlify", &data)) {
goto exit;
+ }
return_value = binascii_hexlify_impl(module, &data);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
@@ -400,8 +426,9 @@ binascii_a2b_hex(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer hexstr = {NULL, NULL};
- if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr))
+ if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) {
goto exit;
+ }
return_value = binascii_a2b_hex_impl(module, &hexstr);
exit:
@@ -432,8 +459,9 @@ binascii_unhexlify(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_buffer hexstr = {NULL, NULL};
- if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr))
+ if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) {
goto exit;
+ }
return_value = binascii_unhexlify_impl(module, &hexstr);
exit:
@@ -465,8 +493,9 @@ binascii_a2b_qp(PyObject *module, PyObject *args, PyObject *kwargs)
int header = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i:a2b_qp", _keywords,
- ascii_buffer_converter, &data, &header))
+ ascii_buffer_converter, &data, &header)) {
goto exit;
+ }
return_value = binascii_a2b_qp_impl(module, &data, header);
exit:
@@ -505,15 +534,17 @@ binascii_b2a_qp(PyObject *module, PyObject *args, PyObject *kwargs)
int header = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii:b2a_qp", _keywords,
- &data, &quotetabs, &istext, &header))
+ &data, &quotetabs, &istext, &header)) {
goto exit;
+ }
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
exit:
/* Cleanup for data */
- if (data.obj)
+ if (data.obj) {
PyBuffer_Release(&data);
+ }
return return_value;
}
-/*[clinic end generated code: output=51173fc9718a5edc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d91d1058dc0590e1 input=a9049054013a1b77]*/