ruby-changes:35906
From: usa <ko1@a...>
Date: Fri, 17 Oct 2014 13:13:54 +0900 (JST)
Subject: [ruby-changes:35906] usa:r47987 (ruby_2_0_0): merge revision(s) 47645: [Backport #10263]
usa 2014-10-17 13:13:38 +0900 (Fri, 17 Oct 2014) New Revision: 47987 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47987 Log: merge revision(s) 47645: [Backport #10263] * vm_eval.c (eval_string_with_cref): fix super from eval with scope. set klass in the current control frame to the class of the receiver in the context to be evaluated, this class/module must match the actual receiver to call super. [ruby-core:65122] [Bug #10263] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_super.rb branches/ruby_2_0_0/version.h branches/ruby_2_0_0/vm_eval.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 47986) +++ ruby_2_0_0/ChangeLog (revision 47987) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Oct 17 13:10:08 2014 Nobuyoshi Nakada <nobu@r...> + + * vm_eval.c (eval_string_with_cref): fix super from eval with + scope. set klass in the current control frame to the class of + the receiver in the context to be evaluated, this class/module + must match the actual receiver to call super. + [ruby-core:65122] [Bug #10263] + Thu Oct 16 16:33:51 2014 NAKAMURA Usaku <usa@r...> * regcomp.c, regexec.c: Optimization should be disabled not only for Index: ruby_2_0_0/vm_eval.c =================================================================== --- ruby_2_0_0/vm_eval.c (revision 47986) +++ ruby_2_0_0/vm_eval.c (revision 47987) @@ -1187,7 +1187,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_eval.c#L1187 absolute_path = file; } - if (scope != Qnil) { + if (!NIL_P(scope)) { if (rb_obj_is_kind_of(scope, rb_cBinding)) { GetBindingPtr(scope, bind); envval = bind->env; @@ -1231,6 +1231,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_eval.c#L1231 th->parse_in_eval--; vm_set_eval_stack(th, iseqval, cref, base_block); + th->cfp->klass = CLASS_OF(base_block->self); if (0) { /* for debug */ VALUE disasm = rb_iseq_disasm(iseqval); Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 47986) +++ ruby_2_0_0/version.h (revision 47987) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 587 +#define RUBY_RELEASE_DATE "2014-10-17" +#define RUBY_PATCHLEVEL 588 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 17 #include "ruby/version.h" Index: ruby_2_0_0/test/ruby/test_super.rb =================================================================== --- ruby_2_0_0/test/ruby/test_super.rb (revision 47986) +++ ruby_2_0_0/test/ruby/test_super.rb (revision 47987) @@ -495,4 +495,19 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_super.rb#L495 end assert_equal(%w[B A], result, bug9721) end + + def test_from_eval + bug10263 = '[ruby-core:65122] [Bug #10263a]' + a = Class.new do + def foo + "A" + end + end + b = Class.new(a) do + def foo + binding.eval("super") + end + end + assert_equal("A", b.new.foo, bug10263) + end end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r47645 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/