ruby-changes:37391
From: nagachika <ko1@a...>
Date: Mon, 2 Feb 2015 22:54:44 +0900 (JST)
Subject: [ruby-changes:37391] nagachika:r49472 (ruby_2_1): merge revision(s) r48160: [Backport #10432]
nagachika 2015-02-02 22:54:38 +0900 (Mon, 02 Feb 2015) New Revision: 49472 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49472 Log: merge revision(s) r48160: [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_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/proc.c branches/ruby_2_1/test/ruby/test_proc.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 49471) +++ ruby_2_1/ChangeLog (revision 49472) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Feb 2 22:47:35 2015 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] + Mon Feb 2 22:43:42 2015 Aaron Patterson <aaron@t...> * lib/resolv.rb: fall back if canonicalization fails. Index: ruby_2_1/proc.c =================================================================== --- ruby_2_1/proc.c (revision 49471) +++ ruby_2_1/proc.c (revision 49472) @@ -2317,7 +2317,10 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_1/proc.c#L2317 method_proc(VALUE method) { VALUE procval; + struct METHOD *meth; rb_proc_t *proc; + rb_env_t *env; + /* * class Method * def to_proc @@ -2327,9 +2330,16 @@ method_proc(VALUE method) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/proc.c#L2330 * 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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 49471) +++ ruby_2_1/version.h (revision 49472) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.5" #define RUBY_RELEASE_DATE "2015-02-02" -#define RUBY_PATCHLEVEL 288 +#define RUBY_PATCHLEVEL 289 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 2 Index: ruby_2_1/test/ruby/test_proc.rb =================================================================== --- ruby_2_1/test/ruby/test_proc.rb (revision 49471) +++ ruby_2_1/test/ruby/test_proc.rb (revision 49472) @@ -202,7 +202,10 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_proc.rb#L202 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_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48160 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/