pycall.rb
pycall.rb copied to clipboard
Keyword argument handling on Ruby 2.7
We can remove the last empty Hash in the following case in Ruby 2.7 because we can distinguish arguments of Hash and keyword arguments in Ruby 2.7.
>> s4 = Pandas::Series.new({c: 100, b: 200, a: 300}, {})
=>
c 100
b 200
a 300
dtype: int64
>> Pandas::Series.new({c: 100, b: 200, a: 300})
Traceback (most recent call last):
6: from /Users/mrkn/.rbenv/versions/2.7/bin/irb:23:in `<main>'
5: from /Users/mrkn/.rbenv/versions/2.7/bin/irb:23:in `load'
4: from /Users/mrkn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
3: from (irb):28
2: from /Users/mrkn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pycall-1.3.0/lib/pycall/pytypeobject_wrapper.rb:24:in `new'
1: from /Users/mrkn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/pycall-1.3.0/lib/pycall/pytypeobject_wrapper.rb:24:in `call_object'
PyCall::PyError (<class 'TypeError'>: __init__() got an unexpected keyword argument 'c')
Same problem +1
We can drop Ruby 2.7 support now.