summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/binascii.c.h
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2015-01-20 19:59:46 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2015-01-20 19:59:46 (GMT)
commitb176d40398f4a6f15fc3f63ef55fb064eca13ee3 (patch)
treefe7c0b7e087391e85c962fc78c7ada63f5758b24 /Modules/clinic/binascii.c.h
parent5a494f6ad850b7d2a4a5007fc27a1a1614a2c2a0 (diff)
downloadcpython-b176d40398f4a6f15fc3f63ef55fb064eca13ee3.zip
cpython-b176d40398f4a6f15fc3f63ef55fb064eca13ee3.tar.gz
cpython-b176d40398f4a6f15fc3f63ef55fb064eca13ee3.tar.bz2
Issue #23280: Fix docstrings for binascii.(un)hexlify
Diffstat (limited to 'Modules/clinic/binascii.c.h')
-rw-r--r--Modules/clinic/binascii.c.h70
1 files changed, 69 insertions, 1 deletions
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index 5247180..f647032 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -367,6 +367,40 @@ exit:
return return_value;
}
+PyDoc_STRVAR(binascii_hexlify__doc__,
+"hexlify($module, data, /)\n"
+"--\n"
+"\n"
+"Hexadecimal representation of binary data.\n"
+"\n"
+"The return value is a bytes object.");
+
+#define BINASCII_HEXLIFY_METHODDEF \
+ {"hexlify", (PyCFunction)binascii_hexlify, METH_VARARGS, binascii_hexlify__doc__},
+
+static PyObject *
+binascii_hexlify_impl(PyModuleDef *module, Py_buffer *data);
+
+static PyObject *
+binascii_hexlify(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer data = {NULL, NULL};
+
+ if (!PyArg_ParseTuple(args,
+ "y*:hexlify",
+ &data))
+ goto exit;
+ return_value = binascii_hexlify_impl(module, &data);
+
+exit:
+ /* Cleanup for data */
+ if (data.obj)
+ PyBuffer_Release(&data);
+
+ return return_value;
+}
+
PyDoc_STRVAR(binascii_a2b_hex__doc__,
"a2b_hex($module, hexstr, /)\n"
"--\n"
@@ -402,6 +436,40 @@ exit:
return return_value;
}
+PyDoc_STRVAR(binascii_unhexlify__doc__,
+"unhexlify($module, hexstr, /)\n"
+"--\n"
+"\n"
+"Binary data of hexadecimal representation.\n"
+"\n"
+"hexstr must contain an even number of hex digits (upper or lower case).");
+
+#define BINASCII_UNHEXLIFY_METHODDEF \
+ {"unhexlify", (PyCFunction)binascii_unhexlify, METH_VARARGS, binascii_unhexlify__doc__},
+
+static PyObject *
+binascii_unhexlify_impl(PyModuleDef *module, Py_buffer *hexstr);
+
+static PyObject *
+binascii_unhexlify(PyModuleDef *module, PyObject *args)
+{
+ PyObject *return_value = NULL;
+ Py_buffer hexstr = {NULL, NULL};
+
+ if (!PyArg_ParseTuple(args,
+ "O&:unhexlify",
+ ascii_buffer_converter, &hexstr))
+ goto exit;
+ return_value = binascii_unhexlify_impl(module, &hexstr);
+
+exit:
+ /* Cleanup for hexstr */
+ if (hexstr.obj)
+ PyBuffer_Release(&hexstr);
+
+ return return_value;
+}
+
PyDoc_STRVAR(binascii_a2b_qp__doc__,
"a2b_qp($module, /, data, header=False)\n"
"--\n"
@@ -475,4 +543,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=68e2bcc6956b6213 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e46d29f8c9adae7e input=a9049054013a1b77]*/