summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-16 14:41:20 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-16 14:41:20 +0000
commit9b5c2baae046fc943cd31279e325d59f13f54b3b (patch)
tree3f883b19a5badf93502183b394da16f7fc4a2d09
parentc3d5ab8f1df087b3df8c8eec27627a4a23491f67 (diff)
merge revision(s) 56694,56698: [Backport #12920]
vm_eval.c: fix refined method when prepended * vm_eval.c (vm_call0_body): refined module should not be skipped as prepended. [ruby-core:78073] [Bug #12920] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_refinement.rb14
-rw-r--r--version.h6
-rw-r--r--vm_eval.c9
4 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index afde8df352..2c6b603ce6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 16 23:40:29 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * vm_eval.c (vm_call0_body): refined module should not be skipped as
+ prepended. [Bug #12920]
+
Tue Nov 15 03:14:02 2016 NARUSE, Yui <naruse@ruby-lang.org>
* ext/-test/file/fs.c (get_atime_p): Updating of file access times
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index f674783a01..dd1c9bcd89 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1623,6 +1623,20 @@ class TestRefinement < Test::Unit::TestCase
end
end
+ def test_refine_with_prepend
+ assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}")
+ begin;
+ bug = '[ruby-core:78073] [Bug #12920]'
+ Fixnum.prepend(Module.new)
+ Module.new do
+ refine Fixnum do
+ define_method(:+) {}
+ end
+ end
+ assert_kind_of(Time, Time.now, bug)
+ end;
+ end
+
private
def eval_using(mod, s)
diff --git a/version.h b/version.h
index 47e0487f6f..1dedf943e2 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.3.3"
-#define RUBY_RELEASE_DATE "2016-11-15"
-#define RUBY_PATCHLEVEL 218
+#define RUBY_RELEASE_DATE "2016-11-16"
+#define RUBY_PATCHLEVEL 219
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 11
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
#include "ruby/version.h"
diff --git a/vm_eval.c b/vm_eval.c
index 57e6393610..8517c0e560 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -200,14 +200,17 @@ vm_call0_body(rb_thread_t* th, struct rb_calling_info *calling, const struct rb_
case VM_METHOD_TYPE_REFINED:
{
const rb_method_type_t type = cc->me->def->type;
- VALUE super_class;
+ VALUE super_class = cc->me->defined_class;
- if (type == VM_METHOD_TYPE_REFINED && cc->me->def->body.refined.orig_me) {
+ if (type == VM_METHOD_TYPE_ZSUPER) {
+ super_class = RCLASS_ORIGIN(super_class);
+ }
+ else if (cc->me->def->body.refined.orig_me) {
cc->me = refined_method_callable_without_refinement(cc->me);
goto again;
}
- super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class));
+ super_class = RCLASS_SUPER(super_class);
if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) {
enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;