diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-20 16:21:06 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-20 16:21:06 +0000 |
commit | f634fc1f8af020d24f3517249e567316e35e196a (patch) | |
tree | 0e722ce3f56790a7682cd6c8e0fc9dea6c36c1ea | |
parent | 9e7b5784180e29b258c99fd36639b5221d427287 (diff) |
merge revision(s) 62115: [Backport #14421]
proc: fix super_method segfault after bind
* proc.c: handle undefined iclass
[ruby-core:85231] [Bug #14421]
From: Eric Wong <e@80x24.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | proc.c | 1 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 5 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 7 insertions, 1 deletions
@@ -2712,6 +2712,7 @@ method_super_method(VALUE method) TypedData_Get_Struct(method, struct METHOD, &method_data_type, data); iclass = data->iclass; + if (!iclass) return Qnil; super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass)); mid = data->me->called_id; if (!super_class) return Qnil; diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 7f173e86ac..128999a4c9 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -923,6 +923,11 @@ class TestMethod < Test::Unit::TestCase assert_equal(m1.source_location, m2.source_location, bug) end + def test_super_method_after_bind + assert_nil String.instance_method(:length).bind(String.new).super_method, + '[ruby-core:85231] [Bug #14421]' + end + def rest_parameter(*rest) rest end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2018-03-21" -#define RUBY_PATCHLEVEL 274 +#define RUBY_PATCHLEVEL 275 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 |