ruby-changes:36552
From: usa <ko1@a...>
Date: Fri, 28 Nov 2014 16:20:54 +0900 (JST)
Subject: [ruby-changes:36552] usa:r48633 (ruby_2_0_0): merge revision(s) 48160: [Backport #10432]
usa 2014-11-28 16:20:40 +0900 (Fri, 28 Nov 2014) New Revision: 48633 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48633 Log: merge revision(s) 48160: [Backport #10432] * proc.c (method_proc): the receiver of binding from method should be same as the receiver of the method. [ruby-core:65917] [Bug #10432] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/proc.c branches/ruby_2_0_0/test/ruby/test_proc.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 48632) +++ ruby_2_0_0/ChangeLog (revision 48633) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Nov 28 16:18:44 2014 Nobuyoshi Nakada <nobu@r...> + + * proc.c (method_proc): the receiver of binding from method should + be same as the receiver of the method. + [ruby-core:65917] [Bug #10432] + Fri Nov 28 16:12:22 2014 NARUSE, Yui <naruse@r...> * lib/net/http.rb (Net::HTTP.proxy_uri): use initializer instead Index: ruby_2_0_0/proc.c =================================================================== --- ruby_2_0_0/proc.c (revision 48632) +++ ruby_2_0_0/proc.c (revision 48633) @@ -2034,7 +2034,10 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/proc.c#L2034 method_proc(VALUE method) { VALUE procval; + struct METHOD *meth; rb_proc_t *proc; + rb_env_t *env; + /* * class Method * def to_proc @@ -2044,9 +2047,16 @@ method_proc(VALUE method) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/proc.c#L2047 * end * end */ + TypedData_Get_Struct(method, struct METHOD, &method_data_type, meth); procval = rb_iterate(mlambda, 0, bmcall, method); GetProcPtr(procval, proc); proc->is_from_method = 1; + proc->block.self = meth->recv; + proc->block.klass = meth->defined_class; + GetEnvPtr(proc->envval, env); + env->block.self = meth->recv; + env->block.klass = meth->defined_class; + env->block.iseq = method_get_iseq(meth->me->def); return procval; } Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 48632) +++ ruby_2_0_0/version.h (revision 48633) @@ -1,6 +1,6 @@ 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-11-28" -#define RUBY_PATCHLEVEL 602 +#define RUBY_PATCHLEVEL 603 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 11 Index: ruby_2_0_0/test/ruby/test_proc.rb =================================================================== --- ruby_2_0_0/test/ruby/test_proc.rb (revision 48632) +++ ruby_2_0_0/test/ruby/test_proc.rb (revision 48633) @@ -179,7 +179,10 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_proc.rb#L179 def test_method_to_proc b = block() assert_equal "OK", b.call - assert_instance_of(Binding, b.binding, '[ruby-core:25589]') + b = b.binding + assert_instance_of(Binding, b, '[ruby-core:25589]') + bug10432 = '[ruby-core:65919] [Bug #10432]' + assert_same(self, b.eval("self"), bug10432) end def test_block_given_method Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48160 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/