Skip to content

spec: Fix compatibility with Ruby 3.4.0 in ranges #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 7, 2025

Conversation

annzenkina
Copy link
Contributor

@annzenkina annzenkina commented Jan 2, 2025

CI in the upstream fails for the latest Ruby version 3.4:

  1) PyCall::PyObjectWrapper#[] when the given index is an Enumerable that is created by Range#step is expected to eq [2, 4, 6, 8]
     Failure/Error: expect(list[(nil..nil).step(-1)]).to eq(PyCall::List.new([*1..10].reverse))

     ArgumentError:
       #step for non-numeric beginless ranges is meaningless
     # ./spec/pycall/pyobject_wrapper_spec.rb:164:in 'Range#step'
     # ./spec/pycall/pyobject_wrapper_spec.rb:164:in 'block (4 levels) in <module:PyCall>'

It looks like this happens due to this change in the most recent Ruby version which doesn't allow to use "beginless" ranges anymore.

This PR sets the range explicitly so we can avoid failing with an exception

See also:

@annzenkina annzenkina force-pushed the fix-ruby3.4.0-tests branch from cf4d537 to 8312f9d Compare January 2, 2025 23:27
@mrkn mrkn added the bug label Feb 7, 2025
@kou
Copy link
Member

kou commented May 7, 2025

Let's work on list[::1] support with Ruby 3.4+ in #206.

Let's fix CI in this PR.

Let's use cc9a073 by @kojix2 in #197.

@kou kou force-pushed the fix-ruby3.4.0-tests branch from f0971a2 to 58cc138 Compare May 7, 2025 00:34
@kou kou changed the title Fix compatibility with Ruby 3.4.0 in ranges spec: Fix compatibility with Ruby 3.4.0 in ranges May 7, 2025
@kou kou merged commit bbd034d into red-data-tools:master May 7, 2025
38 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants