Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d92d4efe
Commit
d92d4efe
authored
Jul 20, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23573: Restored optimization of bytes.rfind() and bytearray.rfind()
for single-byte argument on Linux.
parent
3d0b8422
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
Misc/NEWS
Misc/NEWS
+3
-0
Objects/bytearrayobject.c
Objects/bytearrayobject.c
+7
-3
Objects/bytesobject.c
Objects/bytesobject.c
+7
-3
No files found.
Misc/NEWS
View file @
d92d4efe
...
...
@@ -10,6 +10,9 @@ Release date: 2015-07-26
Core and Builtins
-----------------
- Issue #23573: Restored optimization of bytes.rfind() and bytearray.rfind()
for single-byte argument on Linux.
- Issue #24569: Make PEP 448 dictionary evaluation more consistent.
- Issue #24583: Fix crash when set is mutated while being updated.
...
...
Objects/bytearrayobject.c
View file @
d92d4efe
...
...
@@ -1171,12 +1171,16 @@ bytearray_find_internal(PyByteArrayObject *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
(
PyByteArray_AS_STRING
(
self
)
+
start
,
end
-
start
,
needle
,
needle
,
FAST_SEARCH
);
needle
,
needle
,
mode
);
if
(
res
>=
0
)
res
+=
start
;
}
...
...
Objects/bytesobject.c
View file @
d92d4efe
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment