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

Side by Side Diff: Objects/bytesobject.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 | « Objects/bytearrayobject.c ('k') | Objects/stringlib/find.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* bytes object implementation */ 1 /* bytes object implementation */
2 2
3 #define PY_SSIZE_T_CLEAN 3 #define PY_SSIZE_T_CLEAN
4 4
5 #include "Python.h" 5 #include "Python.h"
6 6
7 #include "bytes_methods.h" 7 #include "bytes_methods.h"
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 static Py_ssize_t 10 static Py_ssize_t
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 if (end < 0) \ 1213 if (end < 0) \
1214 end = 0; \ 1214 end = 0; \
1215 } \ 1215 } \
1216 if (start < 0) { \ 1216 if (start < 0) { \
1217 start += len; \ 1217 start += len; \
1218 if (start < 0) \ 1218 if (start < 0) \
1219 start = 0; \ 1219 start = 0; \
1220 } 1220 }
1221 1221
1222 Py_LOCAL_INLINE(Py_ssize_t) 1222 Py_LOCAL_INLINE(Py_ssize_t)
1223 bytes_find_internal(PyBytesObject *self, PyObject *args, int dir) 1223 bytes_find_internal(PyBytesObject *self, PyObject *args, PyObject *kwds,
1224 int dir)
1224 { 1225 {
1225 PyObject *subobj; 1226 PyObject *subobj;
1226 char byte; 1227 char byte;
1227 Py_buffer subbuf; 1228 Py_buffer subbuf;
1228 const char *sub; 1229 const char *sub;
1229 Py_ssize_t sub_len; 1230 Py_ssize_t sub_len;
1230 Py_ssize_t start=0, end=PY_SSIZE_T_MAX; 1231 Py_ssize_t start=0, end=PY_SSIZE_T_MAX;
1231 Py_ssize_t res; 1232 Py_ssize_t res;
1232 1233
1233 if (!stringlib_parse_args_finds_byte("find/rfind/index/rindex", 1234 if (!stringlib_parse_args_finds_byte("find/rfind/index/rindex",
1234 args, &subobj, &byte, &start, &end)) 1235 args, kwds, &subobj, &byte, &start,
1236 &end))
1235 return -2; 1237 return -2;
1236 1238
1237 if (subobj) { 1239 if (subobj) {
1238 if (_getbuffer(subobj, &subbuf) < 0) 1240 if (_getbuffer(subobj, &subbuf) < 0)
1239 return -2; 1241 return -2;
1240 1242
1241 sub = subbuf.buf; 1243 sub = subbuf.buf;
1242 sub_len = subbuf.len; 1244 sub_len = subbuf.len;
1243 } 1245 }
1244 else { 1246 else {
(...skipping 20 matching lines...) Expand all
1265 PyDoc_STRVAR(find__doc__, 1267 PyDoc_STRVAR(find__doc__,
1266 "B.find(sub[, start[, end]]) -> int\n\ 1268 "B.find(sub[, start[, end]]) -> int\n\
1267 \n\ 1269 \n\
1268 Return the lowest index in B where substring sub is found,\n\ 1270 Return the lowest index in B where substring sub is found,\n\
1269 such that sub is contained within B[start:end]. Optional\n\ 1271 such that sub is contained within B[start:end]. Optional\n\
1270 arguments start and end are interpreted as in slice notation.\n\ 1272 arguments start and end are interpreted as in slice notation.\n\
1271 \n\ 1273 \n\
1272 Return -1 on failure."); 1274 Return -1 on failure.");
1273 1275
1274 static PyObject * 1276 static PyObject *
1275 bytes_find(PyBytesObject *self, PyObject *args) 1277 bytes_find(PyBytesObject *self, PyObject *args, PyObject *kwds)
1276 { 1278 {
1277 Py_ssize_t result = bytes_find_internal(self, args, +1); 1279 Py_ssize_t result = bytes_find_internal(self, args, kwds, +1);
1278 if (result == -2) 1280 if (result == -2)
1279 return NULL; 1281 return NULL;
1280 return PyLong_FromSsize_t(result); 1282 return PyLong_FromSsize_t(result);
1281 } 1283 }
1282 1284
1283 1285
1284 PyDoc_STRVAR(index__doc__, 1286 PyDoc_STRVAR(index__doc__,
1285 "B.index(sub[, start[, end]]) -> int\n\ 1287 "B.index(sub[, start[, end]]) -> int\n\
1286 \n\ 1288 \n\
1287 Like B.find() but raise ValueError when the substring is not found."); 1289 Like B.find() but raise ValueError when the substring is not found.");
1288 1290
1289 static PyObject * 1291 static PyObject *
1290 bytes_index(PyBytesObject *self, PyObject *args) 1292 bytes_index(PyBytesObject *self, PyObject *args, PyObject *kwds)
1291 { 1293 {
1292 Py_ssize_t result = bytes_find_internal(self, args, +1); 1294 Py_ssize_t result = bytes_find_internal(self, args, kwds, +1);
1293 if (result == -2) 1295 if (result == -2)
1294 return NULL; 1296 return NULL;
1295 if (result == -1) { 1297 if (result == -1) {
1296 PyErr_SetString(PyExc_ValueError, 1298 PyErr_SetString(PyExc_ValueError,
1297 "substring not found"); 1299 "substring not found");
1298 return NULL; 1300 return NULL;
1299 } 1301 }
1300 return PyLong_FromSsize_t(result); 1302 return PyLong_FromSsize_t(result);
1301 } 1303 }
1302 1304
1303 1305
1304 PyDoc_STRVAR(rfind__doc__, 1306 PyDoc_STRVAR(rfind__doc__,
1305 "B.rfind(sub[, start[, end]]) -> int\n\ 1307 "B.rfind(sub[, start[, end]]) -> int\n\
1306 \n\ 1308 \n\
1307 Return the highest index in B where substring sub is found,\n\ 1309 Return the highest index in B where substring sub is found,\n\
1308 such that sub is contained within B[start:end]. Optional\n\ 1310 such that sub is contained within B[start:end]. Optional\n\
1309 arguments start and end are interpreted as in slice notation.\n\ 1311 arguments start and end are interpreted as in slice notation.\n\
1310 \n\ 1312 \n\
1311 Return -1 on failure."); 1313 Return -1 on failure.");
1312 1314
1313 static PyObject * 1315 static PyObject *
1314 bytes_rfind(PyBytesObject *self, PyObject *args) 1316 bytes_rfind(PyBytesObject *self, PyObject *args, PyObject *kwds)
1315 { 1317 {
1316 Py_ssize_t result = bytes_find_internal(self, args, -1); 1318 Py_ssize_t result = bytes_find_internal(self, args, kwds, -1);
1317 if (result == -2) 1319 if (result == -2)
1318 return NULL; 1320 return NULL;
1319 return PyLong_FromSsize_t(result); 1321 return PyLong_FromSsize_t(result);
1320 } 1322 }
1321 1323
1322 1324
1323 PyDoc_STRVAR(rindex__doc__, 1325 PyDoc_STRVAR(rindex__doc__,
1324 "B.rindex(sub[, start[, end]]) -> int\n\ 1326 "B.rindex(sub[, start[, end]]) -> int\n\
1325 \n\ 1327 \n\
1326 Like B.rfind() but raise ValueError when the substring is not found."); 1328 Like B.rfind() but raise ValueError when the substring is not found.");
1327 1329
1328 static PyObject * 1330 static PyObject *
1329 bytes_rindex(PyBytesObject *self, PyObject *args) 1331 bytes_rindex(PyBytesObject *self, PyObject *args, PyObject *kwds)
1330 { 1332 {
1331 Py_ssize_t result = bytes_find_internal(self, args, -1); 1333 Py_ssize_t result = bytes_find_internal(self, args, kwds, -1);
1332 if (result == -2) 1334 if (result == -2)
1333 return NULL; 1335 return NULL;
1334 if (result == -1) { 1336 if (result == -1) {
1335 PyErr_SetString(PyExc_ValueError, 1337 PyErr_SetString(PyExc_ValueError,
1336 "substring not found"); 1338 "substring not found");
1337 return NULL; 1339 return NULL;
1338 } 1340 }
1339 return PyLong_FromSsize_t(result); 1341 return PyLong_FromSsize_t(result);
1340 } 1342 }
1341 1343
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 1474
1473 1475
1474 PyDoc_STRVAR(count__doc__, 1476 PyDoc_STRVAR(count__doc__,
1475 "B.count(sub[, start[, end]]) -> int\n\ 1477 "B.count(sub[, start[, end]]) -> int\n\
1476 \n\ 1478 \n\
1477 Return the number of non-overlapping occurrences of substring sub in\n\ 1479 Return the number of non-overlapping occurrences of substring sub in\n\
1478 string B[start:end]. Optional arguments start and end are interpreted\n\ 1480 string B[start:end]. Optional arguments start and end are interpreted\n\
1479 as in slice notation."); 1481 as in slice notation.");
1480 1482
1481 static PyObject * 1483 static PyObject *
1482 bytes_count(PyBytesObject *self, PyObject *args) 1484 bytes_count(PyBytesObject *self, PyObject *args, PyObject *kwds)
1483 { 1485 {
1484 PyObject *sub_obj; 1486 PyObject *sub_obj;
1485 const char *str = PyBytes_AS_STRING(self), *sub; 1487 const char *str = PyBytes_AS_STRING(self), *sub;
1486 Py_ssize_t sub_len; 1488 Py_ssize_t sub_len;
1487 char byte; 1489 char byte;
1488 Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; 1490 Py_ssize_t start = 0, end = PY_SSIZE_T_MAX;
1489 1491
1490 Py_buffer vsub; 1492 Py_buffer vsub;
1491 PyObject *count_obj; 1493 PyObject *count_obj;
1492 1494
1493 if (!stringlib_parse_args_finds_byte("count", args, &sub_obj, &byte, 1495 if (!stringlib_parse_args_finds_byte("count", args, kwds, &sub_obj, &byte,
1494 &start, &end)) 1496 &start, &end))
1495 return NULL; 1497 return NULL;
1496 1498
1497 if (sub_obj) { 1499 if (sub_obj) {
1498 if (_getbuffer(sub_obj, &vsub) < 0) 1500 if (_getbuffer(sub_obj, &vsub) < 0)
1499 return NULL; 1501 return NULL;
1500 1502
1501 sub = vsub.buf; 1503 sub = vsub.buf;
1502 sub_len = vsub.len; 1504 sub_len = vsub.len;
1503 } 1505 }
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 2207
2206 PyDoc_STRVAR(startswith__doc__, 2208 PyDoc_STRVAR(startswith__doc__,
2207 "B.startswith(prefix[, start[, end]]) -> bool\n\ 2209 "B.startswith(prefix[, start[, end]]) -> bool\n\
2208 \n\ 2210 \n\
2209 Return True if B starts with the specified prefix, False otherwise.\n\ 2211 Return True if B starts with the specified prefix, False otherwise.\n\
2210 With optional start, test B beginning at that position.\n\ 2212 With optional start, test B beginning at that position.\n\
2211 With optional end, stop comparing B at that position.\n\ 2213 With optional end, stop comparing B at that position.\n\
2212 prefix can also be a tuple of bytes to try."); 2214 prefix can also be a tuple of bytes to try.");
2213 2215
2214 static PyObject * 2216 static PyObject *
2215 bytes_startswith(PyBytesObject *self, PyObject *args) 2217 bytes_startswith(PyBytesObject *self, PyObject *args, PyObject *kwds)
2216 { 2218 {
2217 Py_ssize_t start = 0; 2219 Py_ssize_t start = 0;
2218 Py_ssize_t end = PY_SSIZE_T_MAX; 2220 Py_ssize_t end = PY_SSIZE_T_MAX;
2219 PyObject *subobj; 2221 PyObject *subobj;
2220 int result; 2222 int result;
2221 2223
2222 if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end)) 2224 if (!stringlib_parse_args_finds("startswith", args, kwds, &subobj, &start,
2225 &end))
2223 return NULL; 2226 return NULL;
2224 if (PyTuple_Check(subobj)) { 2227 if (PyTuple_Check(subobj)) {
2225 Py_ssize_t i; 2228 Py_ssize_t i;
2226 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { 2229 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
2227 result = _bytes_tailmatch(self, 2230 result = _bytes_tailmatch(self,
2228 PyTuple_GET_ITEM(subobj, i), 2231 PyTuple_GET_ITEM(subobj, i),
2229 start, end, -1); 2232 start, end, -1);
2230 if (result == -1) 2233 if (result == -1)
2231 return NULL; 2234 return NULL;
2232 else if (result) { 2235 else if (result) {
(...skipping 16 matching lines...) Expand all
2249 2252
2250 PyDoc_STRVAR(endswith__doc__, 2253 PyDoc_STRVAR(endswith__doc__,
2251 "B.endswith(suffix[, start[, end]]) -> bool\n\ 2254 "B.endswith(suffix[, start[, end]]) -> bool\n\
2252 \n\ 2255 \n\
2253 Return True if B ends with the specified suffix, False otherwise.\n\ 2256 Return True if B ends with the specified suffix, False otherwise.\n\
2254 With optional start, test B beginning at that position.\n\ 2257 With optional start, test B beginning at that position.\n\
2255 With optional end, stop comparing B at that position.\n\ 2258 With optional end, stop comparing B at that position.\n\
2256 suffix can also be a tuple of bytes to try."); 2259 suffix can also be a tuple of bytes to try.");
2257 2260
2258 static PyObject * 2261 static PyObject *
2259 bytes_endswith(PyBytesObject *self, PyObject *args) 2262 bytes_endswith(PyBytesObject *self, PyObject *args, PyObject *kwds)
2260 { 2263 {
2261 Py_ssize_t start = 0; 2264 Py_ssize_t start = 0;
2262 Py_ssize_t end = PY_SSIZE_T_MAX; 2265 Py_ssize_t end = PY_SSIZE_T_MAX;
2263 PyObject *subobj; 2266 PyObject *subobj;
2264 int result; 2267 int result;
2265 2268
2266 if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end)) 2269 if (!stringlib_parse_args_finds("endswith", args, kwds, &subobj, &start,
2270 &end))
2267 return NULL; 2271 return NULL;
2268 if (PyTuple_Check(subobj)) { 2272 if (PyTuple_Check(subobj)) {
2269 Py_ssize_t i; 2273 Py_ssize_t i;
2270 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { 2274 for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
2271 result = _bytes_tailmatch(self, 2275 result = _bytes_tailmatch(self,
2272 PyTuple_GET_ITEM(subobj, i), 2276 PyTuple_GET_ITEM(subobj, i),
2273 start, end, +1); 2277 start, end, +1);
2274 if (result == -1) 2278 if (result == -1)
2275 return NULL; 2279 return NULL;
2276 else if (result) { 2280 else if (result) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 return Py_BuildValue("(y#)", v->ob_sval, Py_SIZE(v)); 2434 return Py_BuildValue("(y#)", v->ob_sval, Py_SIZE(v));
2431 } 2435 }
2432 2436
2433 2437
2434 static PyMethodDef 2438 static PyMethodDef
2435 bytes_methods[] = { 2439 bytes_methods[] = {
2436 {"__getnewargs__", (PyCFunction)bytes_getnewargs, METH_NOARGS}, 2440 {"__getnewargs__", (PyCFunction)bytes_getnewargs, METH_NOARGS},
2437 {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS, 2441 {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS,
2438 _Py_capitalize__doc__}, 2442 _Py_capitalize__doc__},
2439 {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__}, 2443 {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__},
2440 {"count", (PyCFunction)bytes_count, METH_VARARGS, count__doc__}, 2444 {"count", (PyCFunction)bytes_count, METH_VARARGS | METH_KEYWORDS, count__doc __},
2441 {"decode", (PyCFunction)bytes_decode, METH_VARARGS | METH_KEYWORDS, decode__ doc__}, 2445 {"decode", (PyCFunction)bytes_decode, METH_VARARGS | METH_KEYWORDS, decode__ doc__},
2442 {"endswith", (PyCFunction)bytes_endswith, METH_VARARGS, 2446 {"endswith", (PyCFunction)bytes_endswith, METH_VARARGS | METH_KEYWORDS,
2443 endswith__doc__}, 2447 endswith__doc__},
2444 {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS, 2448 {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS,
2445 expandtabs__doc__}, 2449 expandtabs__doc__},
2446 {"find", (PyCFunction)bytes_find, METH_VARARGS, find__doc__}, 2450 {"find", (PyCFunction)bytes_find, METH_VARARGS | METH_KEYWORDS, find__doc__} ,
2447 {"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS, 2451 {"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS,
2448 fromhex_doc}, 2452 fromhex_doc},
2449 {"index", (PyCFunction)bytes_index, METH_VARARGS, index__doc__}, 2453 {"index", (PyCFunction)bytes_index, METH_VARARGS | METH_KEYWORDS, index__doc __},
2450 {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS, 2454 {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS,
2451 _Py_isalnum__doc__}, 2455 _Py_isalnum__doc__},
2452 {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS, 2456 {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS,
2453 _Py_isalpha__doc__}, 2457 _Py_isalpha__doc__},
2454 {"isdigit", (PyCFunction)stringlib_isdigit, METH_NOARGS, 2458 {"isdigit", (PyCFunction)stringlib_isdigit, METH_NOARGS,
2455 _Py_isdigit__doc__}, 2459 _Py_isdigit__doc__},
2456 {"islower", (PyCFunction)stringlib_islower, METH_NOARGS, 2460 {"islower", (PyCFunction)stringlib_islower, METH_NOARGS,
2457 _Py_islower__doc__}, 2461 _Py_islower__doc__},
2458 {"isspace", (PyCFunction)stringlib_isspace, METH_NOARGS, 2462 {"isspace", (PyCFunction)stringlib_isspace, METH_NOARGS,
2459 _Py_isspace__doc__}, 2463 _Py_isspace__doc__},
2460 {"istitle", (PyCFunction)stringlib_istitle, METH_NOARGS, 2464 {"istitle", (PyCFunction)stringlib_istitle, METH_NOARGS,
2461 _Py_istitle__doc__}, 2465 _Py_istitle__doc__},
2462 {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS, 2466 {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS,
2463 _Py_isupper__doc__}, 2467 _Py_isupper__doc__},
2464 {"join", (PyCFunction)bytes_join, METH_O, join__doc__}, 2468 {"join", (PyCFunction)bytes_join, METH_O, join__doc__},
2465 {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__}, 2469 {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__},
2466 {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__}, 2470 {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__},
2467 {"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, lstrip__doc__}, 2471 {"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, lstrip__doc__},
2468 {"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC, 2472 {"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC,
2469 _Py_maketrans__doc__}, 2473 _Py_maketrans__doc__},
2470 {"partition", (PyCFunction)bytes_partition, METH_O, partition__doc__}, 2474 {"partition", (PyCFunction)bytes_partition, METH_O, partition__doc__},
2471 {"replace", (PyCFunction)bytes_replace, METH_VARARGS, replace__doc__}, 2475 {"replace", (PyCFunction)bytes_replace, METH_VARARGS, replace__doc__},
2472 {"rfind", (PyCFunction)bytes_rfind, METH_VARARGS, rfind__doc__}, 2476 {"rfind", (PyCFunction)bytes_rfind, METH_VARARGS | METH_KEYWORDS, rfind__doc __},
2473 {"rindex", (PyCFunction)bytes_rindex, METH_VARARGS, rindex__doc__}, 2477 {"rindex", (PyCFunction)bytes_rindex, METH_VARARGS | METH_KEYWORDS, rindex__ doc__},
2474 {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__}, 2478 {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__},
2475 {"rpartition", (PyCFunction)bytes_rpartition, METH_O, 2479 {"rpartition", (PyCFunction)bytes_rpartition, METH_O,
2476 rpartition__doc__}, 2480 rpartition__doc__},
2477 {"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS | METH_KEYWORDS, rsplit__ doc__}, 2481 {"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS | METH_KEYWORDS, rsplit__ doc__},
2478 {"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, rstrip__doc__}, 2482 {"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, rstrip__doc__},
2479 {"split", (PyCFunction)bytes_split, METH_VARARGS | METH_KEYWORDS, split__doc __}, 2483 {"split", (PyCFunction)bytes_split, METH_VARARGS | METH_KEYWORDS, split__doc __},
2480 {"splitlines", (PyCFunction)bytes_splitlines, METH_VARARGS | METH_KEYWORDS, 2484 {"splitlines", (PyCFunction)bytes_splitlines, METH_VARARGS | METH_KEYWORDS,
2481 splitlines__doc__}, 2485 splitlines__doc__},
2482 {"startswith", (PyCFunction)bytes_startswith, METH_VARARGS, 2486 {"startswith", (PyCFunction)bytes_startswith, METH_VARARGS | METH_KEYWORDS,
2483 startswith__doc__}, 2487 startswith__doc__},
2484 {"strip", (PyCFunction)bytes_strip, METH_VARARGS, strip__doc__}, 2488 {"strip", (PyCFunction)bytes_strip, METH_VARARGS, strip__doc__},
2485 {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS, 2489 {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS,
2486 _Py_swapcase__doc__}, 2490 _Py_swapcase__doc__},
2487 {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__}, 2491 {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__},
2488 {"translate", (PyCFunction)bytes_translate, METH_VARARGS, 2492 {"translate", (PyCFunction)bytes_translate, METH_VARARGS,
2489 translate__doc__}, 2493 translate__doc__},
2490 {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__}, 2494 {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__},
2491 {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__}, 2495 {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__},
2492 {"__sizeof__", (PyCFunction)bytes_sizeof, METH_NOARGS, 2496 {"__sizeof__", (PyCFunction)bytes_sizeof, METH_NOARGS,
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 } 3128 }
3125 it = PyObject_GC_New(striterobject, &PyBytesIter_Type); 3129 it = PyObject_GC_New(striterobject, &PyBytesIter_Type);
3126 if (it == NULL) 3130 if (it == NULL)
3127 return NULL; 3131 return NULL;
3128 it->it_index = 0; 3132 it->it_index = 0;
3129 Py_INCREF(seq); 3133 Py_INCREF(seq);
3130 it->it_seq = (PyBytesObject *)seq; 3134 it->it_seq = (PyBytesObject *)seq;
3131 _PyObject_GC_TRACK(it); 3135 _PyObject_GC_TRACK(it);
3132 return (PyObject *)it; 3136 return (PyObject *)it;
3133 } 3137 }
OLDNEW
« no previous file with comments | « Objects/bytearrayobject.c ('k') | Objects/stringlib/find.h » ('j') | no next file with comments »

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