Skip to content
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

Fix compatibility with Ruby 3.4.0 in ranges #191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

annzenkina
Copy link

@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

@annzenkina annzenkina force-pushed the fix-ruby3.4.0-tests branch from cf4d537 to 8312f9d Compare January 2, 2025 23:27
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.

1 participant