Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(76107)

Unified Diff: Modules/clinic/binascii.c.h

Issue 25357: Add an optional newline parameter to binascii.b2a_base64() to not add a newline
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Modules/binascii.c ('K') | « Modules/binascii.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/clinic/binascii.c.h Fri Oct 09 13:10:05 2015 +0200
+++ b/Modules/clinic/binascii.c.h Fri Oct 09 19:05:11 2015 +0200
@@ -93,26 +93,29 @@ 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(PyModuleDef *module, Py_buffer *data);
+binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data, int newline);
static PyObject *
-binascii_b2a_base64(PyModuleDef *module, PyObject *arg)
+binascii_b2a_base64(PyModuleDef *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 */
@@ -516,4 +519,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=b1a3cbf7660ebaa5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b15a24350d105251 input=a9049054013a1b77]*/
« Modules/binascii.c ('K') | « Modules/binascii.c ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+