summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.c
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2011-04-20 15:42:50 (GMT)
committerJesus Cea <jcea@jcea.es>2011-04-20 15:42:50 (GMT)
commit6159ee3cf59b3fd8fcf9818c0a8071362d1ad7c2 (patch)
treeb88b6a09bb17dadbfef3b400338da44ba881178e /Objects/bytearrayobject.c
parent25458f155a285c60e71e4966bb1b1f6fdfaf7bb1 (diff)
parentac4515063c18157645d135bca8c4cf39542ccd6e (diff)
downloadcpython-6159ee3cf59b3fd8fcf9818c0a8071362d1ad7c2.zip
cpython-6159ee3cf59b3fd8fcf9818c0a8071362d1ad7c2.tar.gz
cpython-6159ee3cf59b3fd8fcf9818c0a8071362d1ad7c2.tar.bz2
MERGE: startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828)
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 0fb7658..827fded 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1081,8 +1081,8 @@ bytearray_find_internal(PyByteArrayObject *self, PyObject *args, int dir)
Py_ssize_t start=0, end=PY_SSIZE_T_MAX;
Py_ssize_t res;
- if (!PyArg_ParseTuple(args, "O|O&O&:find/rfind/index/rindex", &subobj,
- _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end))
+ if (!stringlib_parse_args_finds("find/rfind/index/rindex",
+ args, &subobj, &start, &end))
return -2;
if (_getbuffer(subobj, &subbuf) < 0)
return -2;
@@ -1132,8 +1132,7 @@ bytearray_count(PyByteArrayObject *self, PyObject *args)
Py_buffer vsub;
PyObject *count_obj;
- if (!PyArg_ParseTuple(args, "O|O&O&:count", &sub_obj,
- _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end))
+ if (!stringlib_parse_args_finds("count", args, &sub_obj, &start, &end))
return NULL;
if (_getbuffer(sub_obj, &vsub) < 0)
@@ -1291,8 +1290,7 @@ bytearray_startswith(PyByteArrayObject *self, PyObject *args)
PyObject *subobj;
int result;
- if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj,
- _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end))
+ if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;
@@ -1331,8 +1329,7 @@ bytearray_endswith(PyByteArrayObject *self, PyObject *args)
PyObject *subobj;
int result;
- if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj,
- _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end))
+ if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;