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

Side by Side 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 3 years, 11 months ago
Left:
Right:
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 unified diff | Download patch
« Modules/binascii.c ('K') | « Modules/binascii.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /*[clinic input] 1 /*[clinic input]
2 preserve 2 preserve
3 [clinic start generated code]*/ 3 [clinic start generated code]*/
4 4
5 PyDoc_STRVAR(binascii_a2b_uu__doc__, 5 PyDoc_STRVAR(binascii_a2b_uu__doc__,
6 "a2b_uu($module, data, /)\n" 6 "a2b_uu($module, data, /)\n"
7 "--\n" 7 "--\n"
8 "\n" 8 "\n"
9 "Decode a line of uuencoded data."); 9 "Decode a line of uuencoded data.");
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 exit: 87 exit:
88 /* Cleanup for data */ 88 /* Cleanup for data */
89 if (data.obj) 89 if (data.obj)
90 PyBuffer_Release(&data); 90 PyBuffer_Release(&data);
91 91
92 return return_value; 92 return return_value;
93 } 93 }
94 94
95 PyDoc_STRVAR(binascii_b2a_base64__doc__, 95 PyDoc_STRVAR(binascii_b2a_base64__doc__,
96 "b2a_base64($module, data, /)\n" 96 "b2a_base64($module, /, data, *, newline=1)\n"
97 "--\n" 97 "--\n"
98 "\n" 98 "\n"
99 "Base64-code line of data."); 99 "Base64-code line of data.");
100 100
101 #define BINASCII_B2A_BASE64_METHODDEF \ 101 #define BINASCII_B2A_BASE64_METHODDEF \
102 {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_O, binascii_b2a_base64 __doc__}, 102 {"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_VARARGS|METH_KEYWORDS, binascii_b2a_base64__doc__},
103 103
104 static PyObject * 104 static PyObject *
105 binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data); 105 binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data, int newline);
106 106
107 static PyObject * 107 static PyObject *
108 binascii_b2a_base64(PyModuleDef *module, PyObject *arg) 108 binascii_b2a_base64(PyModuleDef *module, PyObject *args, PyObject *kwargs)
109 { 109 {
110 PyObject *return_value = NULL; 110 PyObject *return_value = NULL;
111 static char *_keywords[] = {"data", "newline", NULL};
111 Py_buffer data = {NULL, NULL}; 112 Py_buffer data = {NULL, NULL};
113 int newline = 1;
112 114
113 if (!PyArg_Parse(arg, "y*:b2a_base64", &data)) 115 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|$i:b2a_base64", _keywords ,
116 &data, &newline))
114 goto exit; 117 goto exit;
115 return_value = binascii_b2a_base64_impl(module, &data); 118 return_value = binascii_b2a_base64_impl(module, &data, newline);
116 119
117 exit: 120 exit:
118 /* Cleanup for data */ 121 /* Cleanup for data */
119 if (data.obj) 122 if (data.obj)
120 PyBuffer_Release(&data); 123 PyBuffer_Release(&data);
121 124
122 return return_value; 125 return return_value;
123 } 126 }
124 127
125 PyDoc_STRVAR(binascii_a2b_hqx__doc__, 128 PyDoc_STRVAR(binascii_a2b_hqx__doc__,
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 goto exit; 512 goto exit;
510 return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header ); 513 return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header );
511 514
512 exit: 515 exit:
513 /* Cleanup for data */ 516 /* Cleanup for data */
514 if (data.obj) 517 if (data.obj)
515 PyBuffer_Release(&data); 518 PyBuffer_Release(&data);
516 519
517 return return_value; 520 return return_value;
518 } 521 }
519 /*[clinic end generated code: output=b1a3cbf7660ebaa5 input=a9049054013a1b77]*/ 522 /*[clinic end generated code: output=af59443d88f6a690 input=a9049054013a1b77]*/
OLDNEW
« 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+