Last active
June 29, 2019 19:58
-
-
Save pariser/691ff2e5e189683c762393add91ce408 to your computer and use it in GitHub Desktop.
compatibility issue with 2.3.0 <= ruby <= 2.3.1 and 5.0.1 <= activesupport < 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo | |
| private_class_method :new | |
| singleton_class.prepend(Module.new) | |
| public_class_method :new | |
| end | |
| puts Foo.method(:new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Relevant code from `singleton` | |
| module Singleton | |
| def self.included(klass) | |
| klass.private_class_method :new, :allocate | |
| end | |
| end | |
| # Relevant code from `active_support` | |
| module ActiveSupport | |
| class Deprecation | |
| module InstanceDelegator | |
| def self.included(base) | |
| # Some other functionality is mixed in here, but the actual functionality is irrelvant | |
| base.singleton_class.prepend(Module.new) | |
| # Overrides method :new to be public | |
| base.public_class_method :new | |
| end | |
| end | |
| # Singleton makes :new method private | |
| include Singleton | |
| # InstanceDelegator makes :new method public | |
| include InstanceDelegator | |
| end | |
| end | |
| # This call outputs: #<ActiveSupport::Deprecation:0x007f9f4884eec0> | |
| puts ActiveSupport::Deprecation.new | |
| # This call hangs in ruby 2.3.1 | |
| ActiveSupport::Deprecation.method(:new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'singleton' | |
| module InstanceDelegator | |
| def self.included(base) | |
| base.singleton_class.prepend(Module.new) | |
| end | |
| end | |
| class Foo | |
| include Singleton | |
| include InstanceDelegator | |
| end | |
| Foo.method(:new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If you run the following in ruby 2.3.1, the issue `.method(:new)` call will halt the process | |
| require 'singleton' | |
| module ActiveSupport | |
| class Deprecation | |
| module InstanceDelegator | |
| def self.included(base) | |
| base.singleton_class.prepend(Module.new) | |
| end | |
| end | |
| end | |
| end | |
| module ActiveSupport | |
| class Deprecation | |
| include Singleton | |
| include InstanceDelegator | |
| end | |
| end | |
| ActiveSupport::Deprecation.method(:new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Pin Ruby version at 2.3.1 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ gem install activesupport -v '~> 4.0' --no-ri --no-rdoc | |
| Successfully installed activesupport-4.2.11.1 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 4.2.11.1 | |
| #<Method: Class#new> | |
| andrew_pariser ~/dev/pariser/sorbet-test $ gem install activesupport -v '5.0.0' --no-ri --no-rdoc | |
| Successfully installed activesupport-5.0.0 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.0.0 | |
| #<Method: Class#new> | |
| andrew_pariser ~/dev/pariser/sorbet-test $ gem install activesupport -v '5.0.1' --no-ri --no-rdoc | |
| Successfully installed activesupport-5.0.1 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.0.1 | |
| ^CKilled: 9 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ gem install activesupport -v '~> 5.0.0' --no-ri --no-rdoc | |
| Successfully installed activesupport-5.0.7.2 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.0.7.2 | |
| ^CKilled: 9 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ gem install activesupport -v '~> 5.1.0' --no-ri --no-rdoc | |
| Successfully installed activesupport-5.1.7 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.1.7 | |
| ^CKilled: 9 | |
| andrew_pariser ~/dev/pariser/sorbet-test 1 $ gem install activesupport -v '~> 5.2.0' --no-ri --no-rdoc | |
| Successfully installed activesupport-5.2.3 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.2.3 | |
| ^CKilled: 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Pin ActiveSupport version at 5.2.3 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ rvm use 2.2.8 | |
| Using /Users/andrew_pariser/.rvm/gems/ruby-2.2.8 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.2.8p477 (2017-09-14 revision 59906) [x86_64-darwin18] | |
| 5.2.3 | |
| #<Method: Class#new> | |
| andrew_pariser ~/dev/pariser/sorbet-test 137 $ rvm use 2.3.0 | |
| Using /Users/andrew_pariser/.rvm/gems/ruby-2.3.0 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin17] | |
| 5.2.3 | |
| ^CKilled: 9 | |
| andrew_pariser ~/dev/pariser/sorbet-test 137 $ rvm use 2.3.1 | |
| Using /Users/andrew_pariser/.rvm/gems/ruby-2.3.1 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin18] | |
| 5.2.3 | |
| ^CKilled: 9 | |
| andrew_pariser ~/dev/pariser/sorbet-test 137 $ rvm use 2.3.2 | |
| Using /Users/andrew_pariser/.rvm/gems/ruby-2.3.2 | |
| andrew_pariser ~/dev/pariser/sorbet-test $ ruby -v && ruby -e 'require "active_support"; puts ActiveSupport.version; puts ActiveSupport::Deprecation.method(:new)' | |
| ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-darwin18] | |
| 5.2.3 | |
| #<Method: Class#new> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running
ActiveSupport::Deprecation.method(:new)using active support version 5.2.3 causes the ruby process to hang (and disallows pry introspection). This happens in ruby 2.3.0 and 2.3.1 but not in ruby 2.3.2.