Commit b62ec64
committed
Fix floating point slice indices in _string_rep in Cython 3.1.*
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 369daeb commit b62ec64
3 files changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 63 | + | |
67 | 64 | | |
68 | 65 | | |
69 | 66 | | |
| |||
| 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