Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(bytearray_clear__doc__, |
| 6 | "clear($self, /)\n" |
| 7 | "--\n" |
| 8 | "\n" |
| 9 | "Remove all items from the bytearray."); |
| 10 | |
| 11 | #define BYTEARRAY_CLEAR_METHODDEF \ |
| 12 | {"clear", (PyCFunction)bytearray_clear, METH_NOARGS, bytearray_clear__doc__}, |
| 13 | |
| 14 | static PyObject * |
| 15 | bytearray_clear_impl(PyByteArrayObject *self); |
| 16 | |
| 17 | static PyObject * |
| 18 | bytearray_clear(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) |
| 19 | { |
| 20 | return bytearray_clear_impl(self); |
| 21 | } |
| 22 | |
| 23 | PyDoc_STRVAR(bytearray_copy__doc__, |
| 24 | "copy($self, /)\n" |
| 25 | "--\n" |
| 26 | "\n" |
| 27 | "Return a copy of B."); |
| 28 | |
| 29 | #define BYTEARRAY_COPY_METHODDEF \ |
| 30 | {"copy", (PyCFunction)bytearray_copy, METH_NOARGS, bytearray_copy__doc__}, |
| 31 | |
| 32 | static PyObject * |
| 33 | bytearray_copy_impl(PyByteArrayObject *self); |
| 34 | |
| 35 | static PyObject * |
| 36 | bytearray_copy(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) |
| 37 | { |
| 38 | return bytearray_copy_impl(self); |
| 39 | } |
| 40 | |
| 41 | PyDoc_STRVAR(bytearray_translate__doc__, |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 42 | "translate($self, table, /, delete=b\'\')\n" |
| 43 | "--\n" |
| 44 | "\n" |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 45 | "Return a copy with each character mapped by the given translation table.\n" |
| 46 | "\n" |
| 47 | " table\n" |
| 48 | " Translation table, which must be a bytes object of length 256.\n" |
| 49 | "\n" |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 50 | "All characters occurring in the optional argument delete are removed.\n" |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 51 | "The remaining characters are mapped through the given translation table."); |
| 52 | |
| 53 | #define BYTEARRAY_TRANSLATE_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 54 | {"translate", (PyCFunction)bytearray_translate, METH_FASTCALL, bytearray_translate__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 55 | |
| 56 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 57 | bytearray_translate_impl(PyByteArrayObject *self, PyObject *table, |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 58 | PyObject *deletechars); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 59 | |
| 60 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 61 | bytearray_translate(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 62 | { |
| 63 | PyObject *return_value = NULL; |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 64 | static const char * const _keywords[] = {"", "delete", NULL}; |
| 65 | static _PyArg_Parser _parser = {"O|O:translate", _keywords, 0}; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 66 | PyObject *table; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 67 | PyObject *deletechars = NULL; |
| 68 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 69 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 70 | &table, &deletechars)) { |
| 71 | goto exit; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 72 | } |
Martin Panter | 1b6c6da | 2016-08-27 08:35:02 +0000 | [diff] [blame] | 73 | return_value = bytearray_translate_impl(self, table, deletechars); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 74 | |
| 75 | exit: |
| 76 | return return_value; |
| 77 | } |
| 78 | |
| 79 | PyDoc_STRVAR(bytearray_maketrans__doc__, |
| 80 | "maketrans(frm, to, /)\n" |
| 81 | "--\n" |
| 82 | "\n" |
| 83 | "Return a translation table useable for the bytes or bytearray translate method.\n" |
| 84 | "\n" |
| 85 | "The returned table will be one where each byte in frm is mapped to the byte at\n" |
| 86 | "the same position in to.\n" |
| 87 | "\n" |
| 88 | "The bytes objects frm and to must be of the same length."); |
| 89 | |
| 90 | #define BYTEARRAY_MAKETRANS_METHODDEF \ |
| 91 | {"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC, bytearray_maketrans__doc__}, |
| 92 | |
| 93 | static PyObject * |
| 94 | bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to); |
| 95 | |
| 96 | static PyObject * |
| 97 | bytearray_maketrans(void *null, PyObject *args) |
| 98 | { |
| 99 | PyObject *return_value = NULL; |
| 100 | Py_buffer frm = {NULL, NULL}; |
| 101 | Py_buffer to = {NULL, NULL}; |
| 102 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 103 | if (!PyArg_ParseTuple(args, "y*y*:maketrans", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 104 | &frm, &to)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 105 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 106 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 107 | return_value = bytearray_maketrans_impl(&frm, &to); |
| 108 | |
| 109 | exit: |
| 110 | /* Cleanup for frm */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 111 | if (frm.obj) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 112 | PyBuffer_Release(&frm); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 113 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 114 | /* Cleanup for to */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 115 | if (to.obj) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 116 | PyBuffer_Release(&to); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 117 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 118 | |
| 119 | return return_value; |
| 120 | } |
| 121 | |
| 122 | PyDoc_STRVAR(bytearray_replace__doc__, |
| 123 | "replace($self, old, new, count=-1, /)\n" |
| 124 | "--\n" |
| 125 | "\n" |
| 126 | "Return a copy with all occurrences of substring old replaced by new.\n" |
| 127 | "\n" |
| 128 | " count\n" |
| 129 | " Maximum number of occurrences to replace.\n" |
| 130 | " -1 (the default value) means replace all occurrences.\n" |
| 131 | "\n" |
| 132 | "If the optional argument count is given, only the first count occurrences are\n" |
| 133 | "replaced."); |
| 134 | |
| 135 | #define BYTEARRAY_REPLACE_METHODDEF \ |
| 136 | {"replace", (PyCFunction)bytearray_replace, METH_VARARGS, bytearray_replace__doc__}, |
| 137 | |
| 138 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 139 | bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old, |
| 140 | Py_buffer *new, Py_ssize_t count); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 141 | |
| 142 | static PyObject * |
| 143 | bytearray_replace(PyByteArrayObject *self, PyObject *args) |
| 144 | { |
| 145 | PyObject *return_value = NULL; |
| 146 | Py_buffer old = {NULL, NULL}; |
| 147 | Py_buffer new = {NULL, NULL}; |
| 148 | Py_ssize_t count = -1; |
| 149 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 150 | if (!PyArg_ParseTuple(args, "y*y*|n:replace", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 151 | &old, &new, &count)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 152 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 153 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 154 | return_value = bytearray_replace_impl(self, &old, &new, count); |
| 155 | |
| 156 | exit: |
| 157 | /* Cleanup for old */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 158 | if (old.obj) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 159 | PyBuffer_Release(&old); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 160 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 161 | /* Cleanup for new */ |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 162 | if (new.obj) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 163 | PyBuffer_Release(&new); |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 164 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 165 | |
| 166 | return return_value; |
| 167 | } |
| 168 | |
| 169 | PyDoc_STRVAR(bytearray_split__doc__, |
| 170 | "split($self, /, sep=None, maxsplit=-1)\n" |
| 171 | "--\n" |
| 172 | "\n" |
| 173 | "Return a list of the sections in the bytearray, using sep as the delimiter.\n" |
| 174 | "\n" |
| 175 | " sep\n" |
| 176 | " The delimiter according which to split the bytearray.\n" |
| 177 | " None (the default value) means split on ASCII whitespace characters\n" |
| 178 | " (space, tab, return, newline, formfeed, vertical tab).\n" |
| 179 | " maxsplit\n" |
| 180 | " Maximum number of splits to do.\n" |
| 181 | " -1 (the default value) means no limit."); |
| 182 | |
| 183 | #define BYTEARRAY_SPLIT_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 184 | {"split", (PyCFunction)bytearray_split, METH_FASTCALL, bytearray_split__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 185 | |
| 186 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 187 | bytearray_split_impl(PyByteArrayObject *self, PyObject *sep, |
| 188 | Py_ssize_t maxsplit); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 189 | |
| 190 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 191 | bytearray_split(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 192 | { |
| 193 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 194 | static const char * const _keywords[] = {"sep", "maxsplit", NULL}; |
| 195 | static _PyArg_Parser _parser = {"|On:split", _keywords, 0}; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 196 | PyObject *sep = Py_None; |
| 197 | Py_ssize_t maxsplit = -1; |
| 198 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 199 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 200 | &sep, &maxsplit)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 201 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 202 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 203 | return_value = bytearray_split_impl(self, sep, maxsplit); |
| 204 | |
| 205 | exit: |
| 206 | return return_value; |
| 207 | } |
| 208 | |
| 209 | PyDoc_STRVAR(bytearray_partition__doc__, |
| 210 | "partition($self, sep, /)\n" |
| 211 | "--\n" |
| 212 | "\n" |
| 213 | "Partition the bytearray into three parts using the given separator.\n" |
| 214 | "\n" |
| 215 | "This will search for the separator sep in the bytearray. If the separator is\n" |
| 216 | "found, returns a 3-tuple containing the part before the separator, the\n" |
| 217 | "separator itself, and the part after it.\n" |
| 218 | "\n" |
| 219 | "If the separator is not found, returns a 3-tuple containing the original\n" |
| 220 | "bytearray object and two empty bytearray objects."); |
| 221 | |
| 222 | #define BYTEARRAY_PARTITION_METHODDEF \ |
| 223 | {"partition", (PyCFunction)bytearray_partition, METH_O, bytearray_partition__doc__}, |
| 224 | |
| 225 | PyDoc_STRVAR(bytearray_rpartition__doc__, |
| 226 | "rpartition($self, sep, /)\n" |
| 227 | "--\n" |
| 228 | "\n" |
| 229 | "Partition the bytes into three parts using the given separator.\n" |
| 230 | "\n" |
| 231 | "This will search for the separator sep in the bytearray, starting and the end.\n" |
| 232 | "If the separator is found, returns a 3-tuple containing the part before the\n" |
| 233 | "separator, the separator itself, and the part after it.\n" |
| 234 | "\n" |
| 235 | "If the separator is not found, returns a 3-tuple containing two empty bytearray\n" |
| 236 | "objects and the original bytearray object."); |
| 237 | |
| 238 | #define BYTEARRAY_RPARTITION_METHODDEF \ |
| 239 | {"rpartition", (PyCFunction)bytearray_rpartition, METH_O, bytearray_rpartition__doc__}, |
| 240 | |
| 241 | PyDoc_STRVAR(bytearray_rsplit__doc__, |
| 242 | "rsplit($self, /, sep=None, maxsplit=-1)\n" |
| 243 | "--\n" |
| 244 | "\n" |
| 245 | "Return a list of the sections in the bytearray, using sep as the delimiter.\n" |
| 246 | "\n" |
| 247 | " sep\n" |
| 248 | " The delimiter according which to split the bytearray.\n" |
| 249 | " None (the default value) means split on ASCII whitespace characters\n" |
| 250 | " (space, tab, return, newline, formfeed, vertical tab).\n" |
| 251 | " maxsplit\n" |
| 252 | " Maximum number of splits to do.\n" |
| 253 | " -1 (the default value) means no limit.\n" |
| 254 | "\n" |
| 255 | "Splitting is done starting at the end of the bytearray and working to the front."); |
| 256 | |
| 257 | #define BYTEARRAY_RSPLIT_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 258 | {"rsplit", (PyCFunction)bytearray_rsplit, METH_FASTCALL, bytearray_rsplit__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 259 | |
| 260 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 261 | bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep, |
| 262 | Py_ssize_t maxsplit); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 263 | |
| 264 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 265 | bytearray_rsplit(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 266 | { |
| 267 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 268 | static const char * const _keywords[] = {"sep", "maxsplit", NULL}; |
| 269 | static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0}; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 270 | PyObject *sep = Py_None; |
| 271 | Py_ssize_t maxsplit = -1; |
| 272 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 273 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 274 | &sep, &maxsplit)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 275 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 276 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 277 | return_value = bytearray_rsplit_impl(self, sep, maxsplit); |
| 278 | |
| 279 | exit: |
| 280 | return return_value; |
| 281 | } |
| 282 | |
| 283 | PyDoc_STRVAR(bytearray_reverse__doc__, |
| 284 | "reverse($self, /)\n" |
| 285 | "--\n" |
| 286 | "\n" |
| 287 | "Reverse the order of the values in B in place."); |
| 288 | |
| 289 | #define BYTEARRAY_REVERSE_METHODDEF \ |
| 290 | {"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, bytearray_reverse__doc__}, |
| 291 | |
| 292 | static PyObject * |
| 293 | bytearray_reverse_impl(PyByteArrayObject *self); |
| 294 | |
| 295 | static PyObject * |
| 296 | bytearray_reverse(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) |
| 297 | { |
| 298 | return bytearray_reverse_impl(self); |
| 299 | } |
| 300 | |
| 301 | PyDoc_STRVAR(bytearray_insert__doc__, |
| 302 | "insert($self, index, item, /)\n" |
| 303 | "--\n" |
| 304 | "\n" |
| 305 | "Insert a single item into the bytearray before the given index.\n" |
| 306 | "\n" |
| 307 | " index\n" |
| 308 | " The index where the value is to be inserted.\n" |
| 309 | " item\n" |
| 310 | " The item to be inserted."); |
| 311 | |
| 312 | #define BYTEARRAY_INSERT_METHODDEF \ |
| 313 | {"insert", (PyCFunction)bytearray_insert, METH_VARARGS, bytearray_insert__doc__}, |
| 314 | |
| 315 | static PyObject * |
| 316 | bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item); |
| 317 | |
| 318 | static PyObject * |
| 319 | bytearray_insert(PyByteArrayObject *self, PyObject *args) |
| 320 | { |
| 321 | PyObject *return_value = NULL; |
| 322 | Py_ssize_t index; |
| 323 | int item; |
| 324 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 325 | if (!PyArg_ParseTuple(args, "nO&:insert", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 326 | &index, _getbytevalue, &item)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 327 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 328 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 329 | return_value = bytearray_insert_impl(self, index, item); |
| 330 | |
| 331 | exit: |
| 332 | return return_value; |
| 333 | } |
| 334 | |
| 335 | PyDoc_STRVAR(bytearray_append__doc__, |
| 336 | "append($self, item, /)\n" |
| 337 | "--\n" |
| 338 | "\n" |
| 339 | "Append a single item to the end of the bytearray.\n" |
| 340 | "\n" |
| 341 | " item\n" |
| 342 | " The item to be appended."); |
| 343 | |
| 344 | #define BYTEARRAY_APPEND_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 345 | {"append", (PyCFunction)bytearray_append, METH_O, bytearray_append__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 346 | |
| 347 | static PyObject * |
| 348 | bytearray_append_impl(PyByteArrayObject *self, int item); |
| 349 | |
| 350 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 351 | bytearray_append(PyByteArrayObject *self, PyObject *arg) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 352 | { |
| 353 | PyObject *return_value = NULL; |
| 354 | int item; |
| 355 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 356 | if (!PyArg_Parse(arg, "O&:append", _getbytevalue, &item)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 357 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 358 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 359 | return_value = bytearray_append_impl(self, item); |
| 360 | |
| 361 | exit: |
| 362 | return return_value; |
| 363 | } |
| 364 | |
| 365 | PyDoc_STRVAR(bytearray_extend__doc__, |
| 366 | "extend($self, iterable_of_ints, /)\n" |
| 367 | "--\n" |
| 368 | "\n" |
| 369 | "Append all the items from the iterator or sequence to the end of the bytearray.\n" |
| 370 | "\n" |
| 371 | " iterable_of_ints\n" |
| 372 | " The iterable of items to append."); |
| 373 | |
| 374 | #define BYTEARRAY_EXTEND_METHODDEF \ |
| 375 | {"extend", (PyCFunction)bytearray_extend, METH_O, bytearray_extend__doc__}, |
| 376 | |
| 377 | PyDoc_STRVAR(bytearray_pop__doc__, |
| 378 | "pop($self, index=-1, /)\n" |
| 379 | "--\n" |
| 380 | "\n" |
| 381 | "Remove and return a single item from B.\n" |
| 382 | "\n" |
| 383 | " index\n" |
| 384 | " The index from where to remove the item.\n" |
| 385 | " -1 (the default value) means remove the last item.\n" |
| 386 | "\n" |
| 387 | "If no index argument is given, will pop the last item."); |
| 388 | |
| 389 | #define BYTEARRAY_POP_METHODDEF \ |
| 390 | {"pop", (PyCFunction)bytearray_pop, METH_VARARGS, bytearray_pop__doc__}, |
| 391 | |
| 392 | static PyObject * |
| 393 | bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index); |
| 394 | |
| 395 | static PyObject * |
| 396 | bytearray_pop(PyByteArrayObject *self, PyObject *args) |
| 397 | { |
| 398 | PyObject *return_value = NULL; |
| 399 | Py_ssize_t index = -1; |
| 400 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 401 | if (!PyArg_ParseTuple(args, "|n:pop", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 402 | &index)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 403 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 404 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 405 | return_value = bytearray_pop_impl(self, index); |
| 406 | |
| 407 | exit: |
| 408 | return return_value; |
| 409 | } |
| 410 | |
| 411 | PyDoc_STRVAR(bytearray_remove__doc__, |
| 412 | "remove($self, value, /)\n" |
| 413 | "--\n" |
| 414 | "\n" |
| 415 | "Remove the first occurrence of a value in the bytearray.\n" |
| 416 | "\n" |
| 417 | " value\n" |
| 418 | " The value to remove."); |
| 419 | |
| 420 | #define BYTEARRAY_REMOVE_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 421 | {"remove", (PyCFunction)bytearray_remove, METH_O, bytearray_remove__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 422 | |
| 423 | static PyObject * |
| 424 | bytearray_remove_impl(PyByteArrayObject *self, int value); |
| 425 | |
| 426 | static PyObject * |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 427 | bytearray_remove(PyByteArrayObject *self, PyObject *arg) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 428 | { |
| 429 | PyObject *return_value = NULL; |
| 430 | int value; |
| 431 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 432 | if (!PyArg_Parse(arg, "O&:remove", _getbytevalue, &value)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 433 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 434 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 435 | return_value = bytearray_remove_impl(self, value); |
| 436 | |
| 437 | exit: |
| 438 | return return_value; |
| 439 | } |
| 440 | |
| 441 | PyDoc_STRVAR(bytearray_strip__doc__, |
| 442 | "strip($self, bytes=None, /)\n" |
| 443 | "--\n" |
| 444 | "\n" |
| 445 | "Strip leading and trailing bytes contained in the argument.\n" |
| 446 | "\n" |
| 447 | "If the argument is omitted or None, strip leading and trailing ASCII whitespace."); |
| 448 | |
| 449 | #define BYTEARRAY_STRIP_METHODDEF \ |
| 450 | {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, bytearray_strip__doc__}, |
| 451 | |
| 452 | static PyObject * |
| 453 | bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes); |
| 454 | |
| 455 | static PyObject * |
| 456 | bytearray_strip(PyByteArrayObject *self, PyObject *args) |
| 457 | { |
| 458 | PyObject *return_value = NULL; |
| 459 | PyObject *bytes = Py_None; |
| 460 | |
| 461 | if (!PyArg_UnpackTuple(args, "strip", |
| 462 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 463 | &bytes)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 464 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 465 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 466 | return_value = bytearray_strip_impl(self, bytes); |
| 467 | |
| 468 | exit: |
| 469 | return return_value; |
| 470 | } |
| 471 | |
| 472 | PyDoc_STRVAR(bytearray_lstrip__doc__, |
| 473 | "lstrip($self, bytes=None, /)\n" |
| 474 | "--\n" |
| 475 | "\n" |
| 476 | "Strip leading bytes contained in the argument.\n" |
| 477 | "\n" |
| 478 | "If the argument is omitted or None, strip leading ASCII whitespace."); |
| 479 | |
| 480 | #define BYTEARRAY_LSTRIP_METHODDEF \ |
| 481 | {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, bytearray_lstrip__doc__}, |
| 482 | |
| 483 | static PyObject * |
| 484 | bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes); |
| 485 | |
| 486 | static PyObject * |
| 487 | bytearray_lstrip(PyByteArrayObject *self, PyObject *args) |
| 488 | { |
| 489 | PyObject *return_value = NULL; |
| 490 | PyObject *bytes = Py_None; |
| 491 | |
| 492 | if (!PyArg_UnpackTuple(args, "lstrip", |
| 493 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 494 | &bytes)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 495 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 496 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 497 | return_value = bytearray_lstrip_impl(self, bytes); |
| 498 | |
| 499 | exit: |
| 500 | return return_value; |
| 501 | } |
| 502 | |
| 503 | PyDoc_STRVAR(bytearray_rstrip__doc__, |
| 504 | "rstrip($self, bytes=None, /)\n" |
| 505 | "--\n" |
| 506 | "\n" |
| 507 | "Strip trailing bytes contained in the argument.\n" |
| 508 | "\n" |
| 509 | "If the argument is omitted or None, strip trailing ASCII whitespace."); |
| 510 | |
| 511 | #define BYTEARRAY_RSTRIP_METHODDEF \ |
| 512 | {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, bytearray_rstrip__doc__}, |
| 513 | |
| 514 | static PyObject * |
| 515 | bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes); |
| 516 | |
| 517 | static PyObject * |
| 518 | bytearray_rstrip(PyByteArrayObject *self, PyObject *args) |
| 519 | { |
| 520 | PyObject *return_value = NULL; |
| 521 | PyObject *bytes = Py_None; |
| 522 | |
| 523 | if (!PyArg_UnpackTuple(args, "rstrip", |
| 524 | 0, 1, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 525 | &bytes)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 526 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 527 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 528 | return_value = bytearray_rstrip_impl(self, bytes); |
| 529 | |
| 530 | exit: |
| 531 | return return_value; |
| 532 | } |
| 533 | |
| 534 | PyDoc_STRVAR(bytearray_decode__doc__, |
| 535 | "decode($self, /, encoding=\'utf-8\', errors=\'strict\')\n" |
| 536 | "--\n" |
| 537 | "\n" |
| 538 | "Decode the bytearray using the codec registered for encoding.\n" |
| 539 | "\n" |
| 540 | " encoding\n" |
| 541 | " The encoding with which to decode the bytearray.\n" |
| 542 | " errors\n" |
| 543 | " The error handling scheme to use for the handling of decoding errors.\n" |
| 544 | " The default is \'strict\' meaning that decoding errors raise a\n" |
| 545 | " UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n" |
| 546 | " as well as any other name registered with codecs.register_error that\n" |
| 547 | " can handle UnicodeDecodeErrors."); |
| 548 | |
| 549 | #define BYTEARRAY_DECODE_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 550 | {"decode", (PyCFunction)bytearray_decode, METH_FASTCALL, bytearray_decode__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 551 | |
| 552 | static PyObject * |
Larry Hastings | 89964c4 | 2015-04-14 18:07:59 -0400 | [diff] [blame] | 553 | bytearray_decode_impl(PyByteArrayObject *self, const char *encoding, |
| 554 | const char *errors); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 555 | |
| 556 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 557 | bytearray_decode(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 558 | { |
| 559 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 560 | static const char * const _keywords[] = {"encoding", "errors", NULL}; |
| 561 | static _PyArg_Parser _parser = {"|ss:decode", _keywords, 0}; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 562 | const char *encoding = NULL; |
| 563 | const char *errors = NULL; |
| 564 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 565 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 566 | &encoding, &errors)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 567 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 568 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 569 | return_value = bytearray_decode_impl(self, encoding, errors); |
| 570 | |
| 571 | exit: |
| 572 | return return_value; |
| 573 | } |
| 574 | |
| 575 | PyDoc_STRVAR(bytearray_join__doc__, |
| 576 | "join($self, iterable_of_bytes, /)\n" |
| 577 | "--\n" |
| 578 | "\n" |
| 579 | "Concatenate any number of bytes/bytearray objects.\n" |
| 580 | "\n" |
| 581 | "The bytearray whose method is called is inserted in between each pair.\n" |
| 582 | "\n" |
| 583 | "The result is returned as a new bytearray object."); |
| 584 | |
| 585 | #define BYTEARRAY_JOIN_METHODDEF \ |
| 586 | {"join", (PyCFunction)bytearray_join, METH_O, bytearray_join__doc__}, |
| 587 | |
| 588 | PyDoc_STRVAR(bytearray_splitlines__doc__, |
| 589 | "splitlines($self, /, keepends=False)\n" |
| 590 | "--\n" |
| 591 | "\n" |
| 592 | "Return a list of the lines in the bytearray, breaking at line boundaries.\n" |
| 593 | "\n" |
| 594 | "Line breaks are not included in the resulting list unless keepends is given and\n" |
| 595 | "true."); |
| 596 | |
| 597 | #define BYTEARRAY_SPLITLINES_METHODDEF \ |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 598 | {"splitlines", (PyCFunction)bytearray_splitlines, METH_FASTCALL, bytearray_splitlines__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 599 | |
| 600 | static PyObject * |
| 601 | bytearray_splitlines_impl(PyByteArrayObject *self, int keepends); |
| 602 | |
| 603 | static PyObject * |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 604 | bytearray_splitlines(PyByteArrayObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 605 | { |
| 606 | PyObject *return_value = NULL; |
Serhiy Storchaka | 9171a8b | 2016-08-14 10:52:18 +0300 | [diff] [blame] | 607 | static const char * const _keywords[] = {"keepends", NULL}; |
| 608 | static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0}; |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 609 | int keepends = 0; |
| 610 | |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 611 | if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 612 | &keepends)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 613 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 614 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 615 | return_value = bytearray_splitlines_impl(self, keepends); |
| 616 | |
| 617 | exit: |
| 618 | return return_value; |
| 619 | } |
| 620 | |
| 621 | PyDoc_STRVAR(bytearray_fromhex__doc__, |
| 622 | "fromhex($type, string, /)\n" |
| 623 | "--\n" |
| 624 | "\n" |
| 625 | "Create a bytearray object from a string of hexadecimal numbers.\n" |
| 626 | "\n" |
| 627 | "Spaces between two numbers are accepted.\n" |
| 628 | "Example: bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')"); |
| 629 | |
| 630 | #define BYTEARRAY_FROMHEX_METHODDEF \ |
Serhiy Storchaka | 92e8af6 | 2015-04-04 00:12:11 +0300 | [diff] [blame] | 631 | {"fromhex", (PyCFunction)bytearray_fromhex, METH_O|METH_CLASS, bytearray_fromhex__doc__}, |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 632 | |
| 633 | static PyObject * |
Serhiy Storchaka | 0855e70 | 2016-07-01 17:22:31 +0300 | [diff] [blame] | 634 | bytearray_fromhex_impl(PyTypeObject *type, PyObject *string); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 635 | |
| 636 | static PyObject * |
Serhiy Storchaka | 0855e70 | 2016-07-01 17:22:31 +0300 | [diff] [blame] | 637 | bytearray_fromhex(PyTypeObject *type, PyObject *arg) |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 638 | { |
| 639 | PyObject *return_value = NULL; |
| 640 | PyObject *string; |
| 641 | |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 642 | if (!PyArg_Parse(arg, "U:fromhex", &string)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 643 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 644 | } |
Serhiy Storchaka | 0855e70 | 2016-07-01 17:22:31 +0300 | [diff] [blame] | 645 | return_value = bytearray_fromhex_impl(type, string); |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 646 | |
| 647 | exit: |
| 648 | return return_value; |
| 649 | } |
| 650 | |
| 651 | PyDoc_STRVAR(bytearray_reduce__doc__, |
| 652 | "__reduce__($self, /)\n" |
| 653 | "--\n" |
| 654 | "\n" |
| 655 | "Return state information for pickling."); |
| 656 | |
| 657 | #define BYTEARRAY_REDUCE_METHODDEF \ |
| 658 | {"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, bytearray_reduce__doc__}, |
| 659 | |
| 660 | static PyObject * |
| 661 | bytearray_reduce_impl(PyByteArrayObject *self); |
| 662 | |
| 663 | static PyObject * |
| 664 | bytearray_reduce(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) |
| 665 | { |
| 666 | return bytearray_reduce_impl(self); |
| 667 | } |
| 668 | |
| 669 | PyDoc_STRVAR(bytearray_reduce_ex__doc__, |
| 670 | "__reduce_ex__($self, proto=0, /)\n" |
| 671 | "--\n" |
| 672 | "\n" |
| 673 | "Return state information for pickling."); |
| 674 | |
| 675 | #define BYTEARRAY_REDUCE_EX_METHODDEF \ |
| 676 | {"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, bytearray_reduce_ex__doc__}, |
| 677 | |
| 678 | static PyObject * |
| 679 | bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto); |
| 680 | |
| 681 | static PyObject * |
| 682 | bytearray_reduce_ex(PyByteArrayObject *self, PyObject *args) |
| 683 | { |
| 684 | PyObject *return_value = NULL; |
| 685 | int proto = 0; |
| 686 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 687 | if (!PyArg_ParseTuple(args, "|i:__reduce_ex__", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 688 | &proto)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 689 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 690 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 691 | return_value = bytearray_reduce_ex_impl(self, proto); |
| 692 | |
| 693 | exit: |
| 694 | return return_value; |
| 695 | } |
| 696 | |
| 697 | PyDoc_STRVAR(bytearray_sizeof__doc__, |
| 698 | "__sizeof__($self, /)\n" |
| 699 | "--\n" |
| 700 | "\n" |
| 701 | "Returns the size of the bytearray object in memory, in bytes."); |
| 702 | |
| 703 | #define BYTEARRAY_SIZEOF_METHODDEF \ |
| 704 | {"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, bytearray_sizeof__doc__}, |
| 705 | |
| 706 | static PyObject * |
| 707 | bytearray_sizeof_impl(PyByteArrayObject *self); |
| 708 | |
| 709 | static PyObject * |
| 710 | bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) |
| 711 | { |
| 712 | return bytearray_sizeof_impl(self); |
| 713 | } |
Victor Stinner | 37e4ef7 | 2016-09-09 20:00:13 -0700 | [diff] [blame] | 714 | /*[clinic end generated code: output=225342a680391b9c input=a9049054013a1b77]*/ |