-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Crash involving the use of DelegateClass
in Ruby 2.7
#1273
Comments
Having an interesting time reproducing this within mutants test suite. Outside its fine. Still on it. |
reproduced within nice. |
@backus This is a bug in 2.7. 2.6 had an imperfect delegate, 2.7 a buggy and 3.0 fixed the issue. require 'delegate'
puts("Ruby-Version: #{RUBY_VERSION}")
class Foo < DelegateClass(String)
def foo
end
end
if Foo.public_instance_methods.any? { |name| name.equal?(:!~) }
puts ":!~ does exist!"
p Foo.instance_method(:!~) # crashes only in 2.7
else
puts ":!~ does NOT exist!"
end |
|
@mbj just tried it out and it seems to work perfectly! Once you cut 0.11.1 I will upgrade our app accordingly. Thanks for getting to this so fast! Helped unblock our upgrade process 😃 |
@backus 0.11.1 was released last night. |
I'm working on upgrading an app to Ruby 2.7 from Ruby 2.6.8 and ran into a crash that only happens under 2.7.
Consider the following code:
Running under 2.6 works fine:
2.7 produces a crash
I believe this is caused by a regression / bug in Ruby 2.7 (or maybe they intentionally did this? No clue). I noticed that the result of
{public,protected,private}_instance_methods
returns more values in 2.7 than it does in 2.6:Not sure if ruby core just changed DelegateClass a lot in 2.7, but this issue from @pocke 1 year ago seems related: https://bugs.ruby-lang.org/issues/16982
The text was updated successfully, but these errors were encountered: