4-2-stable + ruby 2.4 #27473

Merged
merged 16 commits into from Jan 3, 2017

Projects

None yet

9 participants

@matthewd
Member

No description provided.

matthewd and others added some commits Dec 27, 2016
@matthewd matthewd bundle update 2a1c91b
@rafaelfranca @matthewd rafaelfranca Merge pull request #23350 from kamipo/refactor_schema_migration_drop_…
…table

Make `SchemaMigration.drop_table` to one SQL
4b73a36
@jeremy @matthewd jeremy Ruby 2.4: compat with new Array#sum
Ruby 2.4 introduces `Array#sum`, but it only supports numeric elements,
breaking our `Enumerable#sum` which supports arbitrary `Object#+`.
To fix, override `Array#sum` with our compatible implementation.

Native Ruby 2.4:

    %w[ a b ].sum
    # => TypeError: String can't be coerced into Fixnum

With `Enumerable#sum` shim:

    %w[ a b ].sum
    # => 'ab'

We tried shimming the fast path and falling back to the compatible path
if it fails, but that ends up slower even in simple causes due to the cost
of exception handling. Our only choice is to override the native `Array#sum`
with our `Enumerable#sum`.
1f3d640
@rafaelfranca @matthewd rafaelfranca Merge pull request #25766 from vipulnsward/fix-ac-tests-2-4
Fix AJ tests on ruby 2.4 being caused since classes are unified for Integer
d8a969f
@matthewd matthewd Merge pull request #26732 from matthewd/fixnum-warning
Fixnum and Bignum are deprecated in Ruby trunk
b104a5d
@rafaelfranca @matthewd rafaelfranca Merge pull request #26788 from Jesus/master
Use built-in #transform_values when available.
93f2c35
@rafaelfranca @matthewd rafaelfranca Merge pull request #26868 from prathamesh-sonpatki/use-hash-compact-f…
…rom-ruby-24

Use Hash#compact and Hash#compact! from Ruby 2.4
f0e6774
@guilleiguaran @matthewd guilleiguaran Merge pull request #26895 from yui-knk/use_same_class_on_transform_va…
…lues

Ensure `#transform_values` of HWIDA to return HWIDA
f19e196
@amatsuda @matthewd amatsuda Keep AS::XmlMini::PARSING["decimal"].call('') returning 0
BigDecimal('an invalid string') has changed its behavior to raise an ArgumentError since 1.3.0
https://bugs.ruby-lang.org/issues/10286
98b9419
@kaspth @matthewd kaspth Merge pull request #27293 from y-yagi/fix_duplicable_with_2_4
change return value of `duplicable?` with Ruby 2.4+
d89e911
@rafaelfranca @matthewd rafaelfranca Merge pull request #27349 from y-yagi/fix_ruby_warning_in_ruby_2_4
fix new warning in ruby 2.4
e6f5f10
@matthewd matthewd Merge pull request #27366 from utilum/avoid_fixnum_warning
Fix Fixnum deprecated warning in Ruby 2.4+
0608ce3
@maclover7 @matthewd maclover7 Limit length of secret being passed
Very similar to PR #25758, see more in depth reasoning there.
6faffee
@matthewd matthewd Merge pull request #27414 from matthewd/fix-xml-vs-html-assertion
Revise the "XML is not HTML" test
3488a65
@rails-bot

warning Warning warning

  • Pull requests are usually filed against the master branch for this repo, but this one is against 4-2-stable. Please double check that you specified the right target!
@matthewd matthewd Ignore warnings in CLI output
They're not good, but they're not what these tests care about.
ed89a5d
@matthewd
Member

@pixeltrix do you have any thoughts on the smallest / safest / least back-branch-disruptive subset of c9c5788 & friends that would be sensible to backport?

I guess we're only behaving differently (either potentially slower, or potentially cachier, or both) if the configured preserve_timezone doesn't match the intrinsic behaviour of the running version, right? So preserve_timezone=false on pre-2.4 Rubies is zero cost?

@matthewd matthewd Have Bundler resolve for the right Ruby version on Travis
This is a bit over-constraining for the committed lock file, but Travis
ignores that anyway.
fa61939
@pixeltrix
Member

I guess we're only behaving differently (either potentially slower, or potentially cachier, or both) if the configured preserve_timezone doesn't match the intrinsic behaviour of the running version, right? So preserve_timezone=false on pre-2.4 Rubies is zero cost?

Nearly zero - there's still the overhead of checking the config option at runtime. We could change it so that we rewrite the method at boot time, I guess.

As for backporting I think we should be able to do it fairly cleanly - IIRC there's a couple of gotchas but I can have a look at it this week.

@@ -1,5 +1,7 @@
source 'https://rubygems.org'
+ruby "~> #{RUBY_VERSION}" if ENV["TRAVIS"]
@pixeltrix
pixeltrix Jan 3, 2017 Member

Does rvm on Travis not blow up on this line? See rvm/rvm#3705

@matthewd
matthewd Jan 3, 2017 Member

I think that only matters if rvm is trying to parse the ruby version from the Gemfile.

If it's causing local problems, we can probably just obfuscate it a bit so rvm doesn't see it at all (e.g., make it a send).

@pixeltrix
pixeltrix Jan 3, 2017 Member

Is there an option to turn parsing of the Gemfile off?

@matthewd
Member
matthewd commented Jan 3, 2017

Merging ahead of #27553, which will get the build green again.

@matthewd matthewd merged commit 158a856 into rails:4-2-stable Jan 3, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment