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

Side by Side Diff: Objects/bytearrayobject.c

Issue 8706: accept keyword arguments on all base type methods and builtins
Patch Set: Created 8 years, 3 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
« no previous file with comments | « Lib/test/test_userstring.py ('k') | Objects/bytesobject.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* PyByteArray (bytearray) implementation */ 1 /* PyByteArray (bytearray) implementation */
2 2
3 #define PY_SSIZE_T_CLEAN 3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h" 4 #include "Python.h"
5 #include "structmember.h" 5 #include "structmember.h"
6 #include "bytes_methods.h" 6 #include "bytes_methods.h"
7 7
8 char _PyByteArray_empty_string[] = ""; 8 char _PyByteArray_empty_string[] = "";
9 9
10 void 10 void
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 if (end < 0) \ 1061 if (end < 0) \
1062 end = 0; \ 1062 end = 0; \
1063 } \ 1063 } \
1064 if (start < 0) { \ 1064 if (start < 0) { \
1065 start += len; \ 1065 start += len; \
1066 if (start < 0) \ 1066 if (start < 0) \
1067 start = 0; \ 1067 start = 0; \
1068 } 1068 }
1069 1069
1070 Py_LOCAL_INLINE(Py_ssize_t) 1070 Py_LOCAL_INLINE(Py_ssize_t)
1071 bytearray_find_internal(PyByteArrayObject *self, PyObject *args, int dir) 1071 bytearray_find_internal(PyByteArrayObject *self, PyObject *args, PyObject *kwds,
1072 int dir)
1072 { 1073 {
1073 PyObject *subobj; 1074 PyObject *subobj;
1074 char byte; 1075 char byte;
1075 Py_buffer subbuf; 1076 Py_buffer subbuf;
1076 const char *sub; 1077 const char *sub;
1077 Py_ssize_t sub_len; 1078 Py_ssize_t sub_len;
1078 Py_ssize_t start=0, end=PY_SSIZE_T_MAX; 1079 Py_ssize_t start=0, end=PY_SSIZE_T_MAX;
1079 Py_ssize_t res; 1080 Py_ssize_t res;
1080 1081
1081 if (!stringlib_parse_args_finds_byte("find/rfind/index/rindex", 1082 if (!stringlib_parse_args_finds_byte("find/rfind/index/rindex",
1082 args, &subobj, &byte, &start, &end)) 1083 args, kwds, &subobj, &byte, &start,
1084 &end))
1083 return -2; 1085 return -2;
1084 1086
1085 if (subobj) { 1087 if (subobj) {
1086 if (_getbuffer(subobj, &subbuf) < 0) 1088 if (_getbuffer(subobj, &subbuf) < 0)
1087 return -2; 1089 return -2;
1088 1090
1089 sub = subbuf.buf; 1091 sub = subbuf.buf;
1090 sub_len = subbuf.len; 1092 sub_len = subbuf.len;
1091 } 1093 }
1092 else { 1094 else {
(...skipping 19 matching lines...) Expand all
1112 PyDoc_STRVAR(find__doc__, 1114 PyDoc_STRVAR(find__doc__,
1113 "B.find(sub[, start[, end]]) -> int\n\ 1115 "B.find(sub[, start[, end]]) -> int\n\
1114 \n\ 1116 \n\
1115 Return the lowest index in B where subsection sub is found,\n\ 1117 Return the lowest index in B where subsection sub is found,\n\
1116 such that sub is contained within B[start,end]. Optional\n\ 1118 such that sub is contained within B[start,end]. Optional\n\
1117 arguments start and end are interpreted as in slice notation.\n\ 1119 arguments start and end are interpreted as in slice notation.\n\
1118 \n\ 1120 \n\
1119 Return -1 on failure."); 1121 Return -1 on failure.");
1120 1122
1121 static PyObject * 1123 static PyObject *
1122 bytearray_find(PyByteArrayObject *self, PyObject *args) 1124 bytearray_find(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1123 { 1125 {
1124 Py_ssize_t result = bytearray_find_internal(self, args, +1); 1126 Py_ssize_t result = bytearray_find_internal(self, args, kwds, +1);
1125 if (result == -2) 1127 if (result == -2)
1126 return NULL; 1128 return NULL;
1127 return PyLong_FromSsize_t(result); 1129 return PyLong_FromSsize_t(result);
1128 } 1130 }
1129 1131
1130 PyDoc_STRVAR(count__doc__, 1132 PyDoc_STRVAR(count__doc__,
1131 "B.count(sub[, start[, end]]) -> int\n\ 1133 "B.count(sub[, start[, end]]) -> int\n\
1132 \n\ 1134 \n\
1133 Return the number of non-overlapping occurrences of subsection sub in\n\ 1135 Return the number of non-overlapping occurrences of subsection sub in\n\
1134 bytes B[start:end]. Optional arguments start and end are interpreted\n\ 1136 bytes B[start:end]. Optional arguments start and end are interpreted\n\
1135 as in slice notation."); 1137 as in slice notation.");
1136 1138
1137 static PyObject * 1139 static PyObject *
1138 bytearray_count(PyByteArrayObject *self, PyObject *args) 1140 bytearray_count(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1139 { 1141 {
1140 PyObject *sub_obj; 1142 PyObject *sub_obj;
1141 const char *str = PyByteArray_AS_STRING(self), *sub; 1143 const char *str = PyByteArray_AS_STRING(self), *sub;
1142 Py_ssize_t sub_len; 1144 Py_ssize_t sub_len;
1143 char byte; 1145 char byte;
1144 Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; 1146 Py_ssize_t start = 0, end = PY_SSIZE_T_MAX;
1145 1147
1146 Py_buffer vsub; 1148 Py_buffer vsub;
1147 PyObject *count_obj; 1149 PyObject *count_obj;
1148 1150
1149 if (!stringlib_parse_args_finds_byte("count", args, &sub_obj, &byte, 1151 if (!stringlib_parse_args_finds_byte("count", args, kwds, &sub_obj, &byte,
1150 &start, &end)) 1152 &start, &end))
1151 return NULL; 1153 return NULL;
1152 1154
1153 if (sub_obj) { 1155 if (sub_obj) {
1154 if (_getbuffer(sub_obj, &vsub) < 0) 1156 if (_getbuffer(sub_obj, &vsub) < 0)
1155 return NULL; 1157 return NULL;
1156 1158
1157 sub = vsub.buf; 1159 sub = vsub.buf;
1158 sub_len = vsub.len; 1160 sub_len = vsub.len;
1159 } 1161 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 return PyByteArray_FromStringAndSize(PyByteArray_AS_STRING((PyObject *)self) , 1200 return PyByteArray_FromStringAndSize(PyByteArray_AS_STRING((PyObject *)self) ,
1199 PyByteArray_GET_SIZE(self)); 1201 PyByteArray_GET_SIZE(self));
1200 } 1202 }
1201 1203
1202 PyDoc_STRVAR(index__doc__, 1204 PyDoc_STRVAR(index__doc__,
1203 "B.index(sub[, start[, end]]) -> int\n\ 1205 "B.index(sub[, start[, end]]) -> int\n\
1204 \n\ 1206 \n\
1205 Like B.find() but raise ValueError when the subsection is not found."); 1207 Like B.find() but raise ValueError when the subsection is not found.");
1206 1208
1207 static PyObject * 1209 static PyObject *
1208 bytearray_index(PyByteArrayObject *self, PyObject *args) 1210 bytearray_index(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1209 { 1211 {
1210 Py_ssize_t result = bytearray_find_internal(self, args, +1); 1212 Py_ssize_t result = bytearray_find_internal(self, args, kwds, +1);
1211 if (result == -2) 1213 if (result == -2)
1212 return NULL; 1214 return NULL;
1213 if (result == -1) { 1215 if (result == -1) {
1214 PyErr_SetString(PyExc_ValueError, 1216 PyErr_SetString(PyExc_ValueError,
1215 "subsection not found"); 1217 "subsection not found");
1216 return NULL; 1218 return NULL;
1217 } 1219 }
1218 return PyLong_FromSsize_t(result); 1220 return PyLong_FromSsize_t(result);
1219 } 1221 }
1220 1222
1221 1223
1222 PyDoc_STRVAR(rfind__doc__, 1224 PyDoc_STRVAR(rfind__doc__,
1223 "B.rfind(sub[, start[, end]]) -> int\n\ 1225 "B.rfind(sub[, start[, end]]) -> int\n\
1224 \n\ 1226 \n\
1225 Return the highest index in B where subsection sub is found,\n\ 1227 Return the highest index in B where subsection sub is found,\n\
1226 such that sub is contained within B[start,end]. Optional\n\ 1228 such that sub is contained within B[start,end]. Optional\n\
1227 arguments start and end are interpreted as in slice notation.\n\ 1229 arguments start and end are interpreted as in slice notation.\n\
1228 \n\ 1230 \n\
1229 Return -1 on failure."); 1231 Return -1 on failure.");
1230 1232
1231 static PyObject * 1233 static PyObject *
1232 bytearray_rfind(PyByteArrayObject *self, PyObject *args) 1234 bytearray_rfind(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1233 { 1235 {
1234 Py_ssize_t result = bytearray_find_internal(self, args, -1); 1236 Py_ssize_t result = bytearray_find_internal(self, args, kwds, -1);
1235 if (result == -2) 1237 if (result == -2)
1236 return NULL; 1238 return NULL;
1237 return PyLong_FromSsize_t(result); 1239 return PyLong_FromSsize_t(result);
1238 } 1240 }
1239 1241
1240 1242
1241 PyDoc_STRVAR(rindex__doc__, 1243 PyDoc_STRVAR(rindex__doc__,
1242 "B.rindex(sub[, start[, end]]) -> int\n\ 1244 "B.rindex(sub[, start[, end]]) -> int\n\
1243 \n\ 1245 \n\
1244 Like B.rfind() but raise ValueError when the subsection is not found."); 1246 Like B.rfind() but raise ValueError when the subsection is not found.");
1245 1247
1246 static PyObject * 1248 static PyObject *
1247 bytearray_rindex(PyByteArrayObject *self, PyObject *args) 1249 bytearray_rindex(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1248 { 1250 {
1249 Py_ssize_t result = bytearray_find_internal(self, args, -1); 1251 Py_ssize_t result = bytearray_find_internal(self, args, kwds, -1);
1250 if (result == -2) 1252 if (result == -2)
1251 return NULL; 1253 return NULL;
1252 if (result == -1) { 1254 if (result == -1) {
1253 PyErr_SetString(PyExc_ValueError, 1255 PyErr_SetString(PyExc_ValueError,
1254 "subsection not found"); 1256 "subsection not found");
1255 return NULL; 1257 return NULL;
1256 } 1258 }
1257 return PyLong_FromSsize_t(result); 1259 return PyLong_FromSsize_t(result);
1258 } 1260 }
1259 1261
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1329
1328 PyDoc_STRVAR(startswith__doc__, 1330 PyDoc_STRVAR(startswith__doc__,
1329 "B.startswith(prefix[, start[, end]]) -> bool\n\ 1331 "B.startswith(prefix[, start[, end]]) -> bool\n\
1330 \n\ 1332 \n\
1331 Return True if B starts with the specified prefix, False otherwise.\n\ 1333 Return True if B starts with the specified prefix, False otherwise.\n\
1332 With optional start, test B beginning at that position.\n\ 1334 With optional start, test B beginning at that position.\n\
1333 With optional end, stop comparing B at that position.\n\ 1335 With optional end, stop comparing B at that position.\n\
1334 prefix can also be a tuple of bytes to try."); 1336 prefix can also be a tuple of bytes to try.");
1335 1337
1336 static PyObject * 1338 static PyObject *
1337 bytearray_startswith(PyByteArrayObject *self, PyObject *args) 1339 bytearray_startswith(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1338 { 1340 {
1339 Py_ssize_t start = 0; 1341 Py_ssize_t start = 0;
1340 Py_ssize_t end = PY_SSIZE_T_MAX; 1342 Py_ssize_t end = PY_SSIZE_T_MAX;
1341 PyObject *subobj; 1343 PyObject *subobj;
1342 int result; 1344 int result;
1343 1345
1344 if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end)) 1346 if (!stringlib_parse_args_finds("startswith", args, kwds, &subobj, &start,
1347 &end))
1345 return NULL; 1348 return NULL;
1346 if (PyTuple_Check(subobj)) { 1349 if (PyTuple_Check(subobj)) {
1347 Py_ssize_t i; 1350 Py_ssize_t i;
1348 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { 1351 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
1349 result = _bytearray_tailmatch(self, 1352 result = _bytearray_tailmatch(self,
1350 PyTuple_GET_ITEM(subobj, i), 1353 PyTuple_GET_ITEM(subobj, i),
1351 start, end, -1); 1354 start, end, -1);
1352 if (result == -1) 1355 if (result == -1)
1353 return NULL; 1356 return NULL;
1354 else if (result) { 1357 else if (result) {
(...skipping 15 matching lines...) Expand all
1370 1373
1371 PyDoc_STRVAR(endswith__doc__, 1374 PyDoc_STRVAR(endswith__doc__,
1372 "B.endswith(suffix[, start[, end]]) -> bool\n\ 1375 "B.endswith(suffix[, start[, end]]) -> bool\n\
1373 \n\ 1376 \n\
1374 Return True if B ends with the specified suffix, False otherwise.\n\ 1377 Return True if B ends with the specified suffix, False otherwise.\n\
1375 With optional start, test B beginning at that position.\n\ 1378 With optional start, test B beginning at that position.\n\
1376 With optional end, stop comparing B at that position.\n\ 1379 With optional end, stop comparing B at that position.\n\
1377 suffix can also be a tuple of bytes to try."); 1380 suffix can also be a tuple of bytes to try.");
1378 1381
1379 static PyObject * 1382 static PyObject *
1380 bytearray_endswith(PyByteArrayObject *self, PyObject *args) 1383 bytearray_endswith(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
1381 { 1384 {
1382 Py_ssize_t start = 0; 1385 Py_ssize_t start = 0;
1383 Py_ssize_t end = PY_SSIZE_T_MAX; 1386 Py_ssize_t end = PY_SSIZE_T_MAX;
1384 PyObject *subobj; 1387 PyObject *subobj;
1385 int result; 1388 int result;
1386 1389
1387 if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end)) 1390 if (!stringlib_parse_args_finds("endswith", args, kwds, &subobj, &start,
1391 &end))
1388 return NULL; 1392 return NULL;
1389 if (PyTuple_Check(subobj)) { 1393 if (PyTuple_Check(subobj)) {
1390 Py_ssize_t i; 1394 Py_ssize_t i;
1391 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { 1395 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
1392 result = _bytearray_tailmatch(self, 1396 result = _bytearray_tailmatch(self,
1393 PyTuple_GET_ITEM(subobj, i), 1397 PyTuple_GET_ITEM(subobj, i),
1394 start, end, +1); 1398 start, end, +1);
1395 if (result == -1) 1399 if (result == -1)
1396 return NULL; 1400 return NULL;
1397 else if (result) { 1401 else if (result) {
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 {"__alloc__", (PyCFunction)bytearray_alloc, METH_NOARGS, alloc_doc}, 2830 {"__alloc__", (PyCFunction)bytearray_alloc, METH_NOARGS, alloc_doc},
2827 {"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, reduce_doc}, 2831 {"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, reduce_doc},
2828 {"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, reduce_ex_ doc}, 2832 {"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, reduce_ex_ doc},
2829 {"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, sizeof_doc}, 2833 {"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, sizeof_doc},
2830 {"append", (PyCFunction)bytearray_append, METH_O, append__doc__}, 2834 {"append", (PyCFunction)bytearray_append, METH_O, append__doc__},
2831 {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS, 2835 {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS,
2832 _Py_capitalize__doc__}, 2836 _Py_capitalize__doc__},
2833 {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__}, 2837 {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__},
2834 {"clear", (PyCFunction)bytearray_clear, METH_NOARGS, clear__doc__}, 2838 {"clear", (PyCFunction)bytearray_clear, METH_NOARGS, clear__doc__},
2835 {"copy", (PyCFunction)bytearray_copy, METH_NOARGS, copy__doc__}, 2839 {"copy", (PyCFunction)bytearray_copy, METH_NOARGS, copy__doc__},
2836 {"count", (PyCFunction)bytearray_count, METH_VARARGS, count__doc__}, 2840 {"count", (PyCFunction)bytearray_count, METH_VARARGS | METH_KEYWORDS, count_ _doc__},
2837 {"decode", (PyCFunction)bytearray_decode, METH_VARARGS | METH_KEYWORDS, deco de_doc}, 2841 {"decode", (PyCFunction)bytearray_decode, METH_VARARGS | METH_KEYWORDS, deco de_doc},
2838 {"endswith", (PyCFunction)bytearray_endswith, METH_VARARGS, endswith__doc__} , 2842 {"endswith", (PyCFunction)bytearray_endswith, METH_VARARGS | METH_KEYWORDS, endswith__doc__},
2839 {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS, 2843 {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS,
2840 expandtabs__doc__}, 2844 expandtabs__doc__},
2841 {"extend", (PyCFunction)bytearray_extend, METH_O, extend__doc__}, 2845 {"extend", (PyCFunction)bytearray_extend, METH_O, extend__doc__},
2842 {"find", (PyCFunction)bytearray_find, METH_VARARGS, find__doc__}, 2846 {"find", (PyCFunction)bytearray_find, METH_VARARGS | METH_KEYWORDS, find__do c__},
2843 {"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS, 2847 {"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS,
2844 fromhex_doc}, 2848 fromhex_doc},
2845 {"index", (PyCFunction)bytearray_index, METH_VARARGS, index__doc__}, 2849 {"index", (PyCFunction)bytearray_index, METH_VARARGS | METH_KEYWORDS, index_ _doc__},
2846 {"insert", (PyCFunction)bytearray_insert, METH_VARARGS, insert__doc__}, 2850 {"insert", (PyCFunction)bytearray_insert, METH_VARARGS, insert__doc__},
2847 {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS, 2851 {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS,
2848 _Py_isalnum__doc__}, 2852 _Py_isalnum__doc__},
2849 {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS, 2853 {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS,
2850 _Py_isalpha__doc__}, 2854 _Py_isalpha__doc__},
2851 {"isdigit", (PyCFunction)stringlib_isdigit, METH_NOARGS, 2855 {"isdigit", (PyCFunction)stringlib_isdigit, METH_NOARGS,
2852 _Py_isdigit__doc__}, 2856 _Py_isdigit__doc__},
2853 {"islower", (PyCFunction)stringlib_islower, METH_NOARGS, 2857 {"islower", (PyCFunction)stringlib_islower, METH_NOARGS,
2854 _Py_islower__doc__}, 2858 _Py_islower__doc__},
2855 {"isspace", (PyCFunction)stringlib_isspace, METH_NOARGS, 2859 {"isspace", (PyCFunction)stringlib_isspace, METH_NOARGS,
2856 _Py_isspace__doc__}, 2860 _Py_isspace__doc__},
2857 {"istitle", (PyCFunction)stringlib_istitle, METH_NOARGS, 2861 {"istitle", (PyCFunction)stringlib_istitle, METH_NOARGS,
2858 _Py_istitle__doc__}, 2862 _Py_istitle__doc__},
2859 {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS, 2863 {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS,
2860 _Py_isupper__doc__}, 2864 _Py_isupper__doc__},
2861 {"join", (PyCFunction)bytearray_join, METH_O, join_doc}, 2865 {"join", (PyCFunction)bytearray_join, METH_O, join_doc},
2862 {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__}, 2866 {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__},
2863 {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__}, 2867 {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__},
2864 {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, lstrip__doc__}, 2868 {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, lstrip__doc__},
2865 {"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC, 2869 {"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC,
2866 _Py_maketrans__doc__}, 2870 _Py_maketrans__doc__},
2867 {"partition", (PyCFunction)bytearray_partition, METH_O, partition__doc__}, 2871 {"partition", (PyCFunction)bytearray_partition, METH_O, partition__doc__},
2868 {"pop", (PyCFunction)bytearray_pop, METH_VARARGS, pop__doc__}, 2872 {"pop", (PyCFunction)bytearray_pop, METH_VARARGS, pop__doc__},
2869 {"remove", (PyCFunction)bytearray_remove, METH_O, remove__doc__}, 2873 {"remove", (PyCFunction)bytearray_remove, METH_O, remove__doc__},
2870 {"replace", (PyCFunction)bytearray_replace, METH_VARARGS, replace__doc__}, 2874 {"replace", (PyCFunction)bytearray_replace, METH_VARARGS, replace__doc__},
2871 {"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, reverse__doc__}, 2875 {"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, reverse__doc__},
2872 {"rfind", (PyCFunction)bytearray_rfind, METH_VARARGS, rfind__doc__}, 2876 {"rfind", (PyCFunction)bytearray_rfind, METH_VARARGS | METH_KEYWORDS, rfind_ _doc__},
2873 {"rindex", (PyCFunction)bytearray_rindex, METH_VARARGS, rindex__doc__}, 2877 {"rindex", (PyCFunction)bytearray_rindex, METH_VARARGS | METH_KEYWORDS, rind ex__doc__},
2874 {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__}, 2878 {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__},
2875 {"rpartition", (PyCFunction)bytearray_rpartition, METH_O, rpartition__doc__} , 2879 {"rpartition", (PyCFunction)bytearray_rpartition, METH_O, rpartition__doc__} ,
2876 {"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS | METH_KEYWORDS, rspl it__doc__}, 2880 {"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS | METH_KEYWORDS, rspl it__doc__},
2877 {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, rstrip__doc__}, 2881 {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, rstrip__doc__},
2878 {"split", (PyCFunction)bytearray_split, METH_VARARGS | METH_KEYWORDS, split_ _doc__}, 2882 {"split", (PyCFunction)bytearray_split, METH_VARARGS | METH_KEYWORDS, split_ _doc__},
2879 {"splitlines", (PyCFunction)bytearray_splitlines, 2883 {"splitlines", (PyCFunction)bytearray_splitlines,
2880 METH_VARARGS | METH_KEYWORDS, splitlines__doc__}, 2884 METH_VARARGS | METH_KEYWORDS, splitlines__doc__},
2881 {"startswith", (PyCFunction)bytearray_startswith, METH_VARARGS , 2885 {"startswith", (PyCFunction)bytearray_startswith, METH_VARARGS | METH_KEYWOR DS,
2882 startswith__doc__}, 2886 startswith__doc__},
2883 {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, strip__doc__}, 2887 {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, strip__doc__},
2884 {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS, 2888 {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS,
2885 _Py_swapcase__doc__}, 2889 _Py_swapcase__doc__},
2886 {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__}, 2890 {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__},
2887 {"translate", (PyCFunction)bytearray_translate, METH_VARARGS, 2891 {"translate", (PyCFunction)bytearray_translate, METH_VARARGS,
2888 translate__doc__}, 2892 translate__doc__},
2889 {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__}, 2893 {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__},
2890 {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__}, 2894 {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__},
2891 {NULL} 2895 {NULL}
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 } 3064 }
3061 it = PyObject_GC_New(bytesiterobject, &PyByteArrayIter_Type); 3065 it = PyObject_GC_New(bytesiterobject, &PyByteArrayIter_Type);
3062 if (it == NULL) 3066 if (it == NULL)
3063 return NULL; 3067 return NULL;
3064 it->it_index = 0; 3068 it->it_index = 0;
3065 Py_INCREF(seq); 3069 Py_INCREF(seq);
3066 it->it_seq = (PyByteArrayObject *)seq; 3070 it->it_seq = (PyByteArrayObject *)seq;
3067 _PyObject_GC_TRACK(it); 3071 _PyObject_GC_TRACK(it);
3068 return (PyObject *)it; 3072 return (PyObject *)it;
3069 } 3073 }
OLDNEW
« no previous file with comments | « Lib/test/test_userstring.py ('k') | Objects/bytesobject.c » ('j') | no next file with comments »

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