Skip to content

Conversation

@zachoverflow
Copy link
Contributor

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: #134

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: Ezibenroc#134
@Ezibenroc Ezibenroc merged commit 8e93421 into Ezibenroc:master Oct 8, 2025
18 checks passed
@Ezibenroc
Copy link
Owner

Hello and sorry for the late answer. Good catch, it's great that we will be able to unpin Cython !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does not build with cython 3.1.x

2 participants