1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) r47037: [Backport #10106]

* vm_insnhelper.c (vm_call_method): unusable super class should cause
	  method missing when BasicObject is refined but not been using.
	  [ruby-core:64166] [Bug #10106]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-08-22 17:49:32 +00:00
parent b4893fc3d1
commit 80aa5ce577
4 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 23 02:39:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): unusable super class should cause
method missing when BasicObject is refined but not been using.
[ruby-core:64166] [Bug #10106]
Sat Aug 23 02:22:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_count): fix wrong single-byte optimization.

View file

@ -1152,6 +1152,21 @@ class TestRefinement < Test::Unit::TestCase
INPUT
end
def test_refine_basic_object
assert_separately([], <<-"end;")
bug10106 = '[ruby-core:64166] [Bug #10106]'
module RefinementBug
refine BasicObject do
def foo
1
end
end
end
assert_raise(NoMethodError, bug10106) {Object.new.foo}
end;
end
private
def eval_using(mod, s)

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-08-23"
#define RUBY_PATCHLEVEL 206
#define RUBY_PATCHLEVEL 207
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 8

View file

@ -1791,6 +1791,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
klass = RCLASS_ORIGIN(klass);
zsuper_method_dispatch:
klass = RCLASS_SUPER(klass);
if (!klass) {
ci->me = 0;
goto start_method_dispatch;
}
ci_temp = *ci;
ci = &ci_temp;