Explicitly unpack the expanded args to avoid execution order diff. #26854

Merged
merged 1 commit into from Oct 21, 2016

Projects

None yet

5 participants

@headius
Contributor
headius commented Oct 21, 2016

Summary

In https://bugs.ruby-lang.org/issues/12860 I argue that MRI's
execution order here is incorrect. The splatting of the 'c' args
should happen before the shift, but it happens after. On JRuby, it
behaves the way you would expect, leading to the 'c' args splat
still containing the block and producing an error like "cannot
convert proc to symbol" when the send attempts to coerce
it.

This patch makes the unpacking order explicit with a multi-assign,
which behaves properly on all implementations I tested.

Additional Information

This code appears to have been introduced after the most recent Rails release so I don't think it needs to be backported. I started running into the "proc to symbol" errors only after switching to master for JRuby testing.

@headius headius Explicitly unpack the expanded args to avoid execution order diff.
In https://bugs.ruby-lang.org/issues/12860 I argue that MRI's
execution order here is incorrect. The splatting of the 'c' args
should happen before the shift, but it happens after. On JRuby, it
behaves the way you would expect, leading to the 'c' args splat
still containing the block and producing an error like "cannot
convert proc to symbol" when the send attempts to coerce
it.

This patch makes the unpacking order explicit with a multi-assign,
which behaves properly on all implementations I tested.
5f382d4
@senny senny was assigned by rails-bot Oct 21, 2016
@rails-bot

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @senny (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@tenderlove tenderlove merged commit 0a3595f into rails:master Oct 21, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
codeclimate Code Climate didn't find any new or fixed issues.
Details
@headius headius added a commit to headius/rails that referenced this pull request Oct 21, 2016
@headius headius Additional fix for argument-splat ordering differences.
See #26854
2674392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment