Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3632624
Support tuples for `find` & `rfind`
nineteendo May 24, 2024
e39b040
Update docs
nineteendo May 24, 2024
cb905bc
Add tests
nineteendo May 24, 2024
1807fd8
📜🤖 Added by blurb_it.
blurb-it[bot] May 24, 2024
cca08fa
Apply suggestions from code review
nineteendo May 24, 2024
302faa3
Apply suggestions from code review
nineteendo May 24, 2024
cb95578
Fix signature tests
nineteendo May 24, 2024
a35d3ae
Short circuit
nineteendo May 24, 2024
65c0a9e
Fix start for `rfind`
nineteendo May 25, 2024
5cbb1f0
Refactor checks
nineteendo May 25, 2024
00b2b04
Fix end for `rfind`
nineteendo May 25, 2024
e124603
Adjust indices
nineteendo May 25, 2024
41b0cd8
Micro optimisation
nineteendo May 25, 2024
7b83a22
Fix conversion
nineteendo May 25, 2024
c905458
Fix condition
nineteendo May 25, 2024
5c79f24
Add tests
nineteendo May 25, 2024
148b471
Clarify documentation
nineteendo May 25, 2024
351dc83
Add constant
nineteendo May 25, 2024
ddaf4b4
Duplicate constant
nineteendo May 25, 2024
2b044a1
Add tests
nineteendo May 25, 2024
a632f25
Remove newline
nineteendo May 25, 2024
ef28dab
Update Lib/test/string_tests.py
nineteendo May 25, 2024
4207d54
Update Lib/test/string_tests.py
nineteendo May 25, 2024
0dff482
Update Lib/test/string_tests.py
nineteendo May 25, 2024
fc0d9ea
Update Lib/test/string_tests.py
nineteendo May 25, 2024
cd317fd
Don't check twice on boundary
nineteendo May 25, 2024
43e8259
Apply suggestions from code review
nineteendo May 25, 2024
2524dc1
Apply suggestions from code review
nineteendo May 25, 2024
dbc8c94
Test bytes
nineteendo May 25, 2024
49a28a0
Add more bytes tests
nineteendo May 25, 2024
0bd606d
Support tuples for index & rindex
nineteendo May 25, 2024
b337fdc
Update Objects/bytes_methods.c
nineteendo May 25, 2024
e43373f
Update Misc/NEWS.d/next/Core and Builtins/2024-05-24-11-07-16.gh-issu…
nineteendo May 25, 2024
b47b0e0
Update docs
nineteendo May 25, 2024
6f71b39
Refactor code
nineteendo May 26, 2024
64ef311
Fix error message
nineteendo May 26, 2024
a116f33
Add asserts
nineteendo May 26, 2024
e29828d
Remove unnecessary check
nineteendo May 26, 2024
a85f84a
Revert "Remove unnecessary check"
nineteendo May 26, 2024
ac19e87
Optimise length of 0 & 1
nineteendo May 26, 2024
b62e8b4
Avoid testing with tuples of 1 item
nineteendo May 26, 2024
b6492db
Simplify news.
nineteendo May 26, 2024
dd23e04
Fix indentation
nineteendo May 26, 2024
38d2df8
Handle -2
nineteendo May 26, 2024
223cb1b
Update Misc/NEWS.d/next/Core and Builtins/2024-05-24-11-07-16.gh-issu…
nineteendo May 27, 2024
bc29c92
Guard overflow
nineteendo May 27, 2024
f14ee7d
Tweak `FIND_CHUNK_SIZE`
nineteendo May 27, 2024
3606e00
Refer to `re` & `regex`
nineteendo May 28, 2024
9e2006c
Release buffer
nineteendo May 28, 2024
fb48c41
Release other buffer
nineteendo May 29, 2024
308174c
Save lengths
nineteendo May 29, 2024
6a3d651
malloc
nineteendo May 29, 2024
3227e63
Fix malloc
nineteendo May 29, 2024
70d673f
Store needles for bytes
nineteendo Jun 1, 2024
7b205b3
Revert test
nineteendo Jun 1, 2024
0664ced
Restructure code
nineteendo Jun 1, 2024
b132742
Fix smelly symbol
nineteendo Jun 1, 2024
8189c66
Make static
nineteendo Jun 1, 2024
53d3a07
Remove variable
nineteendo Jun 1, 2024
648725d
Reverse comparison
nineteendo Jun 1, 2024
4fe06fb
Add brackets
nineteendo Jun 1, 2024
145f45d
Remove continue
nineteendo Jun 1, 2024
c96775c
2 arguments per line
nineteendo Jun 1, 2024
b4722c4
Exclude long needles
nineteendo Jun 1, 2024
5c8751a
Include needles with a larger kind
nineteendo Jun 1, 2024
c219cf5
fast find for strings
nineteendo Jun 2, 2024
ccbfa0e
Fix argument type
nineteendo Jun 2, 2024
aada7f5
Rename argument
nineteendo Jun 2, 2024
090ddee
Decrease diff
nineteendo Jun 2, 2024
6b85fd7
Decrease diff 2
nineteendo Jun 2, 2024
41a6c20
Decrease diff 3
nineteendo Jun 2, 2024
460effa
Remove continue
nineteendo Jun 2, 2024
d1c4af6
Parentheses
nineteendo Jun 2, 2024
c19ddcf
Store converted needles on the heap
nineteendo Jun 2, 2024
6beae49
cleanup
nineteendo Jun 2, 2024
ff514be
Fix uninitialised variable
nineteendo Jun 2, 2024
ff6eea2
Try to prevent segmentation fault
nineteendo Jun 2, 2024
0cbf03a
Fix cast
nineteendo Jun 2, 2024
d412046
Revert "Fix cast"
nineteendo Jun 2, 2024
168fe84
Revert "Try to prevent segmentation fault"
nineteendo Jun 2, 2024
41b11e5
Uninitialised memory?
nineteendo Jun 3, 2024
ffe1152
More tests
nineteendo Jun 3, 2024
ac91f79
Rename parameter
nineteendo Jun 3, 2024
6751992
Unnest
nineteendo Jun 3, 2024
44aebd1
Keep buffers acquired during search
nineteendo Jun 3, 2024
9a51fd9
Add `buffers_len`
nineteendo Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add asserts
  • Loading branch information
nineteendo committed May 26, 2024
commit a116f33b78c81b4947a9d1fc7b69af6ec3497f01
2 changes: 2 additions & 0 deletions Objects/bytes_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ find_first_internal(const char *str, Py_ssize_t len, const char *function_name,
ADJUST_INDICES(start, end, len);
// Work in chunks
if (direction > 0) {
assert(FIND_CHUNK_SIZE > 0);
for (; result == -1 && start <= end; start += FIND_CHUNK_SIZE) {
Py_ssize_t cur_end = start + FIND_CHUNK_SIZE - 1;
for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
Expand Down Expand Up @@ -611,6 +612,7 @@ find_first_internal(const char *str, Py_ssize_t len, const char *function_name,
}
else {
Py_ssize_t cur_end = end;
assert(RFIND_CHUNK_SIZE > 0);
for (; result == -1 && cur_end >= start; cur_end -= RFIND_CHUNK_SIZE) {
Py_ssize_t cur_start = cur_end - RFIND_CHUNK_SIZE + 1;
if (cur_start < start) {
Expand Down
2 changes: 2 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -9170,6 +9170,7 @@ any_find_first_slice(PyObject *str, const char *function_name,
ADJUST_INDICES(start, end, len);
// Work in chunks
if (direction > 0) {
assert(FIND_CHUNK_SIZE > 0);
for (; result == -1 && start <= end; start += FIND_CHUNK_SIZE) {
Py_ssize_t cur_end = start + FIND_CHUNK_SIZE - 1;
for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(subobj); i++) {
Expand All @@ -9192,6 +9193,7 @@ any_find_first_slice(PyObject *str, const char *function_name,
}
else {
Py_ssize_t cur_end = end;
assert(RFIND_CHUNK_SIZE > 0);
for (; result == -1 && cur_end >= start; cur_end -= RFIND_CHUNK_SIZE) {
Py_ssize_t cur_start = cur_end - RFIND_CHUNK_SIZE + 1;
if (cur_start < start) {
Expand Down