[Python-checkins] cpython: Issue #23573: Fix bytes.rfind() and bytearray.rfind() on Windows
victor.stinner
python-checkins at python.org
Wed Mar 25 03:17:13 CET 2015
https://hg.python.org/cpython/rev/3ac58de829ef
changeset: 95192:3ac58de829ef
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Mar 25 03:16:32 2015 +0100
summary:
Issue #23573: Fix bytes.rfind() and bytearray.rfind() on Windows
Windows has no memrchr() function.
This change is only a workaround, the optimization must be reenabled on other
platforms.
files:
Objects/bytearrayobject.c | 3 ++-
Objects/bytesobject.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1166,7 +1166,8 @@
ADJUST_INDICES(start, end, len);
if (end - start < sub_len)
res = -1;
- else if (sub_len == 1) {
+ /* Issue #23573: FIXME, windows has no memrchr() */
+ else if (sub_len == 1 && dir > 0) {
unsigned char needle = *sub;
int mode = (dir > 0) ? FAST_SEARCH : FAST_RSEARCH;
res = stringlib_fastsearch_memchr_1char(
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -1938,7 +1938,8 @@
ADJUST_INDICES(start, end, len);
if (end - start < sub_len)
res = -1;
- else if (sub_len == 1) {
+ /* Issue #23573: FIXME, windows has no memrchr() */
+ else if (sub_len == 1 && dir > 0) {
unsigned char needle = *sub;
int mode = (dir > 0) ? FAST_SEARCH : FAST_RSEARCH;
res = stringlib_fastsearch_memchr_1char(
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list