diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2015-01-20 20:11:38 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2015-01-20 20:11:38 (GMT) |
commit | b4826c3fd160375903b1380b09490a016771d7c9 (patch) | |
tree | 2555add57fdfcc4b88e5593e0cef46092a77960d /Modules/clinic/binascii.c.h | |
parent | 08f3143aea534efb25b176ede8499a4bb23472f7 (diff) | |
parent | b176d40398f4a6f15fc3f63ef55fb064eca13ee3 (diff) | |
download | cpython-b4826c3fd160375903b1380b09490a016771d7c9.zip cpython-b4826c3fd160375903b1380b09490a016771d7c9.tar.gz cpython-b4826c3fd160375903b1380b09490a016771d7c9.tar.bz2 |
Merge with 3.4 (closes #23280)
Diffstat (limited to 'Modules/clinic/binascii.c.h')
-rw-r--r-- | Modules/clinic/binascii.c.h | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h index 6147be9..b2b6e6b 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=53cd6b379c745220 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=771126f8f53e84e7 input=a9049054013a1b77]*/ |