Skip to content

Conversation

@chhtz
Copy link
Member

@chhtz chhtz commented Nov 24, 2025

(instead of named parameter)

This fixes an error which made using e.g. oroshell (but probably anything capable of introspecting orogen tasks from ruby) unusable in ruby 3.x.

I have no idea if this is the right way to fix this

With ruby 2.7 this fixes a warning:

/opt/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:45: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/opt/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:61: warning: The called method `initialize' is defined here

With ruby 3.2 this fixes an error:

/opt/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:66:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from /opt/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:50:in `new'
	from /opt/workspace/tools/orocos.rb/lib/orocos/ruby_tasks/task_context.rb:50:in `new'
	from /opt/workspace/tools/orocos.rb/lib/orocos/base.rb:304:in `initialize'
	from /opt/workspace/tools/orocos.rb/bin/oroshell:18:in `<main>'

@chhtz chhtz marked this pull request as draft November 24, 2025 16:25
@chhtz
Copy link
Member Author

chhtz commented Nov 24, 2025

This PR is definitely not enough. E.g., trying to use Orocos.get will lead to similar errors with wrong number of arguments.
I can dig deeper into that, but I'd first need to know what the correct way to handle named+hash parameters is.

@doudou
Copy link
Member

doudou commented Nov 24, 2025

This is the right interface. What needs to be changed is the caller.

Can you show me the calling code ?

@doudou
Copy link
Member

doudou commented Nov 24, 2025

I'm hopeful I'll have the opportunity to start working on ubuntu >= 24.04 soon ... Sorry I can't directly help so far.

@chhtz
Copy link
Member Author

chhtz commented Nov 24, 2025

Can you show me the calling code ?

The callstack is in the main comment, but it looks like I didn't remove my debug code before copying the error. Direct caller was in line 45:

        remote_task = super(local_task.ior, name: name, model: model, **options)

I'm hopeful I'll have the opportunity to start working on ubuntu >= 24.04 soon ... Sorry I can't directly help so far.

I think it would already help fixing all warning: Using the last argument as keyword parameters is deprecated; (these happen in ruby 2.7 already, and apparently break with ruby 3.x).

Addendum: This warning occurs directly, e.g., when calling oroshell on the command line.

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.

3 participants