Commit bbd034d
spec: Fix compatibility with Ruby 3.4.0 in ranges (#191)
[CI in the
upstream](https://github.com/mrkn/pycall.rb/actions/runs/12501779028/job/34879787889)
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](https://github.com/ruby/ruby/blame/master/range.c#L524-L527)
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:
* https://bugs.ruby-lang.org/issues/18368
* ruby/ruby#7444
---------
Co-authored-by: Kenta Murata <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: kojix2 <[email protected]>1 parent 899fbf5 commit bbd034d
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
0 commit comments