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

Fully separate positional arguments and keyword arguments #2794

Merged
merged 3 commits into from
Jan 3, 2020

Conversation

jeremyevans
Copy link
Contributor

No description provided.

@jeremyevans
Copy link
Contributor Author

The test-bundler failures appear to be due to:

/home/runner/work/ruby/ruby/src/tmp/1/gems/base/gems/mustermann-1.0.3/lib/mustermann/regular.rb:22:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)

I think in order to fix this:

  1. mustermann needs to be fixed (Support Ruby 3 keyword arguments sinatra/mustermann#97)
  2. An updated mustermann gem needs to be released
  3. Bundler needs to be updated to use the updated mustermann version
  4. Ruby needs to be updated to use the updated bundler

@namusyaka
Copy link

@jeremyevans Now the PR has been merged, and a new version including the changes has been released: https://rubygems.org/gems/mustermann/versions/1.1.0

@jeremyevans
Copy link
Contributor Author

Now the failure is due to sinatra. Sinatra needs a new release with the following commit: sinatra/sinatra@d423f56. Then bundler needs to be updated to use it, and the bundler changes merged into Ruby.

@namusyaka
Copy link

This removes the warnings added in 2.7, and changes the behavior
so that a final positional hash is not treated as keywords or
vice-versa.

To handle the arg_setup_block splat case correctly with keyword
arguments, we need to check if we are taking a keyword hash.
That case didn't have a test, but it affects real-world code,
so add a test for it.

This removes rb_empty_keyword_given_p() and related code, as
that is not needed in Ruby 3.  The empty keyword case is the
same as the no keyword case in Ruby 3.

This changes rb_scan_args to implement keyword argument
separation for C functions when the : character is used.
For backwards compatibility, it returns a duped hash.
This is a bad idea for performance, but not duping the hash
breaks at least Enumerator::ArithmeticSequence#inspect.

Instead of having RB_PASS_CALLED_KEYWORDS be a number,
simplify the code by just making it be rb_keyword_given_p().
@jeremyevans jeremyevans merged commit e014e6b into ruby:master Jan 3, 2020
@jeremyevans jeremyevans deleted the r3 branch January 3, 2020 02:40
kamipo added a commit to kamipo/image_processing that referenced this pull request Jan 4, 2020
Rails CI with Ruby master has broken by ruby/ruby#2794.

https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1205

To fix the CI failure, fixing kwargs deprecation warnings is required.
kamipo added a commit to kamipo/minimagick that referenced this pull request Jan 4, 2020
kamipo added a commit to kamipo/minimagick that referenced this pull request Jan 4, 2020
kamipo added a commit to kamipo/minimagick that referenced this pull request Jan 4, 2020
janko pushed a commit to minimagick/minimagick that referenced this pull request Jan 6, 2020
* Fix Ruby 2.7 warnings

Rails CI with Ruby master has broken by ruby/ruby#2794.

https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235
https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94

To fix the CI failure, fixing kwargs deprecation warnings is required.

* Drop Ruby 1.9 support to use double splat `**options`
koic added a commit to koic/cancancan that referenced this pull request Jan 10, 2020
## Summary

This PR suppresses the following keyword arguments warning for Ruby 2.7.0.

```console
% ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17]
% DB=sqlite bundle exec appraisal activerecord_6.0.0 rake

/Users/koic/src/github.com/CanCanCommunity/cancancan/lib/cancan/unauthorized_message_resolver.rb:9:
warning: Using the last argument as keyword parameters is deprecated;
maybe ** should be added to the call
/Users/koic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.8.0/lib/i18n.rb:195:
warning: The called method `translate' is defined here
```

For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`.
ruby/ruby#2794

## Other Infromation

There are other similar warnings against Active Record, but Rails 6.0
stable branch is WIP.
rails/rails#37935

It is not subject to changes in this repository.
koic added a commit to koic/cancancan that referenced this pull request Jan 10, 2020
## Summary

This PR suppresses the following keyword arguments warning for Ruby 2.7.0.

```console
% ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17]
% DB=sqlite bundle exec appraisal activerecord_6.0.0 rake

/Users/koic/src/github.com/CanCanCommunity/cancancan/lib/cancan/unauthorized_message_resolver.rb:9:
warning: Using the last argument as keyword parameters is deprecated;
maybe ** should be added to the call
/Users/koic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.8.0/lib/i18n.rb:195:
warning: The called method `translate' is defined here
```

For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`.
ruby/ruby#2794

## Other Infromation

There are other similar warnings against Active Record, but Rails 6.0
stable branch is WIP.
rails/rails#37935

It is not subject to changes in this repository.
koic added a commit to koic/hashie that referenced this pull request Jan 15, 2020
This PR suppresses the following keyword arguments warning for Ruby 2.7.0.

```console
% bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb
(snip)

/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29:
warning: Using the last argument as keyword parameters is
deprecated; maybe ** should be added to the call
/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21:
warning: The called method `call' is defined here
```

For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`.
ruby/ruby#2794
koic added a commit to koic/hashie that referenced this pull request Jan 15, 2020
This PR suppresses the following keyword arguments warning for Ruby 2.7.0.

```console
% bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb
(snip)

/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29:
warning: Using the last argument as keyword parameters is
deprecated; maybe ** should be added to the call
/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21:
warning: The called method `call' is defined here
```

For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`.
ruby/ruby#2794
michaelzedwards added a commit to michaelzedwards/hashie that referenced this pull request Feb 11, 2022
This PR suppresses the following keyword arguments warning for Ruby 2.7.0.

```console
% bundle exec rspec spec/hashie/extensions/mash/symbolize_keys_spec.rb
(snip)

/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:29:
warning: Using the last argument as keyword parameters is
deprecated; maybe ** should be added to the call
/Users/koic/src/github.com/hahie/hashie/spec/hashie/extensions/mash/symbolize_keys_spec.rb:21:
warning: The called method `call' is defined here
```

For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`.
ruby/ruby#2794
KarimHamidou pushed a commit to KarimHamidou/minimagick that referenced this pull request Feb 6, 2023
* Fix Ruby 2.7 warnings

Rails CI with Ruby master has broken by ruby/ruby#2794.

https://buildkite.com/rails/rails/builds/66163#c6c0c423-bb9b-4c20-bab4-8a6aa56c726d/936-1235
https://github.com/rails/rails/blob/5a010d8537afa957f1a6c7ec0d9f4d66ef5ae5e1/activestorage/test/test_helper.rb#L94

To fix the CI failure, fixing kwargs deprecation warnings is required.

* Drop Ruby 1.9 support to use double splat `**options`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants