summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-05-16 19:24:03 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-05-16 19:24:03 (GMT)
commit4b23494ded6c452d2b777938654a10b2ad5122aa (patch)
treee2c4246fce610ef83e0b188cda41f0508c2cd4ef /Objects
parentaa99b8e36594242d7ef2f61cd03a1dd35bd018c8 (diff)
parent7bf36dace8c3d3714dfe5175891612450cb82ce5 (diff)
downloadcpython-4b23494ded6c452d2b777938654a10b2ad5122aa.zip
cpython-4b23494ded6c452d2b777938654a10b2ad5122aa.tar.gz
cpython-4b23494ded6c452d2b777938654a10b2ad5122aa.tar.bz2
Issue #27039: Fixed bytearray.remove() for values greater than 127.
Based on patch by Joe Jevnik.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytearrayobject.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 9457768..b7dfd6f 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1734,11 +1734,8 @@ bytearray_remove_impl(PyByteArrayObject *self, int value)
Py_ssize_t where, n = Py_SIZE(self);
char *buf = PyByteArray_AS_STRING(self);
- for (where = 0; where < n; where++) {
- if (buf[where] == value)
- break;
- }
- if (where == n) {
+ where = stringlib_find_char(buf, n, value);
+ if (where < 0) {
PyErr_SetString(PyExc_ValueError, "value not found in bytearray");
return NULL;
}