Commit 8e93421
authored
Fix floating point slice indices in _string_rep in Cython 3.1.* (#136)
Tracked down the issue preventing `TestString::test_large_list`
from passing when compiling with Cython 3.1.*.
Specifically, the issue came down to the calculated `num_rows` in
`_string_rep` staying floating point instead of getting cast to an
int.
I'm not sure whether Cython 3.1.* broke variable shadowing, or
optimized out `num_rows = int(num_rows)`... or something else. But in
any case, we can avoid the floating point operations (and float-typed
variable) by switching _string_rep to use the following formula for
calculating the celing of integer division:
`ceil(x / y) = (x + y - 1) // y`
Since all tests now pass on Cython 3.1.*, this change also removes the
upper constraints on Cython.
Fixes: #1341 parent fa8f92b commit 8e93421
3 files changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 71 | + | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments