Skip to content

Commit 50d3445

Browse files
committed
merge revision(s) r47037: [Backport ruby#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 ruby#10106] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent def5eab commit 50d3445

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Sat Aug 23 02:39:20 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* vm_insnhelper.c (vm_call_method): unusable super class should cause
4+
method missing when BasicObject is refined but not been using.
5+
[ruby-core:64166] [Bug #10106]
6+
17
Sat Aug 23 02:22:02 2014 Nobuyoshi Nakada <[email protected]>
28

39
* string.c (rb_str_count): fix wrong single-byte optimization.

test/ruby/test_refinement.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,21 @@ def m
11521152
INPUT
11531153
end
11541154

1155+
def test_refine_basic_object
1156+
assert_separately([], <<-"end;")
1157+
bug10106 = '[ruby-core:64166] [Bug #10106]'
1158+
module RefinementBug
1159+
refine BasicObject do
1160+
def foo
1161+
1
1162+
end
1163+
end
1164+
end
1165+
1166+
assert_raise(NoMethodError, bug10106) {Object.new.foo}
1167+
end;
1168+
end
1169+
11551170
private
11561171

11571172
def eval_using(mod, s)

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-08-23"
3-
#define RUBY_PATCHLEVEL 206
3+
#define RUBY_PATCHLEVEL 207
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 8

vm_insnhelper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
17911791
klass = RCLASS_ORIGIN(klass);
17921792
zsuper_method_dispatch:
17931793
klass = RCLASS_SUPER(klass);
1794+
if (!klass) {
1795+
ci->me = 0;
1796+
goto start_method_dispatch;
1797+
}
17941798
ci_temp = *ci;
17951799
ci = &ci_temp;
17961800

0 commit comments

Comments
 (0)