diff options
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 6a6e930f73..08275ad5ad 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1815,12 +1815,16 @@ bytes_find_internal(PyBytesObject *self, PyObject *args, int dir) ADJUST_INDICES(start, end, len); if (end - start < sub_len) res = -1; - /* Issue #23573: FIXME, windows has no memrchr() */ - else if (sub_len == 1 && dir > 0) { + else if (sub_len == 1 +#ifndef HAVE_MEMRCHR + && dir > 0 +#endif + ) { unsigned char needle = *sub; + int mode = (dir > 0) ? FAST_SEARCH : FAST_RSEARCH; res = stringlib_fastsearch_memchr_1char( PyBytes_AS_STRING(self) + start, end - start, - needle, needle, FAST_SEARCH); + needle, needle, mode); if (res >= 0) res += start; } |