diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-25 02:16:32 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-25 02:16:32 (GMT) |
| commit | dabbfe7b3017ff6ba62fb4c44c63a43c180532dd (patch) | |
| tree | ad978feac0c2631ff44aee65c3f33d80c9122977 /Objects/bytesobject.c | |
| parent | 39183dfc682568e8a00203c26caee893f49ff390 (diff) | |
| download | cpython-dabbfe7b3017ff6ba62fb4c44c63a43c180532dd.zip cpython-dabbfe7b3017ff6ba62fb4c44c63a43c180532dd.tar.gz cpython-dabbfe7b3017ff6ba62fb4c44c63a43c180532dd.tar.bz2 | |
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.
Diffstat (limited to 'Objects/bytesobject.c')
| -rw-r--r-- | Objects/bytesobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index ae3c289..4d6b3e4 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1938,7 +1938,8 @@ bytes_find_internal(PyBytesObject *self, PyObject *args, int dir) 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( |
