Skip to content

Conversation

@pocke
Copy link
Member

@pocke pocke commented Sep 12, 2021

IO.console method raises an ArgumentError when it receives keyword arguments due to the Ruby 3 keyword args change. For example:

$ docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=2.4 ./all-ruby -r io/console -e 'IO.console(:clone, freeze: true)'
ruby-2.4.0          
...
ruby-2.7.0-preview1 
ruby-2.7.0-preview2 -e:1: warning: The last argument is used as the keyword parameter
...
ruby-2.7.0-rc1      -e:1: warning: The last argument is used as the keyword parameter
ruby-2.7.0-rc2      -e:1: warning: The last argument is used as keyword parameters
ruby-2.7.0          -e:1: warning: Using the last argument as keyword parameters is deprecated
...
ruby-2.7.4          -e:1: warning: Using the last argument as keyword parameters is deprecated
ruby-3.0.0-preview1 <internal:kernel>:47:in `clone': wrong number of arguments (given 1, expected 0) (ArgumentError)
                    	from -e:1:in `console'
                    	from -e:1:in `<main>'
                exit 1
...
ruby-3.0.2          <internal:kernel>:47:in `clone': wrong number of arguments (given 1, expected 0) (ArgumentError)
                    	from -e:1:in `console'
                    	from -e:1:in `<main>'
                exit 1

This patch fixes the problem.

@pocke pocke force-pushed the Fix_ArgumentError_when_IO_console_receives_keyword_args branch 2 times, most recently from 97a6b27 to ae7d144 Compare September 12, 2021 07:12
@pocke pocke force-pushed the Fix_ArgumentError_when_IO_console_receives_keyword_args branch from ae7d144 to 789b93d Compare September 12, 2021 07:16
@nobu nobu merged commit 6b29b90 into ruby:master Dec 26, 2021
@pocke pocke deleted the Fix_ArgumentError_when_IO_console_receives_keyword_args branch December 26, 2021 06:36
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.

2 participants