[前][次][番号順一覧][スレッド一覧]

ruby-changes:42339

From: naruse <ko1@a...>
Date: Wed, 30 Mar 2016 01:06:29 +0900 (JST)
Subject: [ruby-changes:42339] naruse:r54413 (ruby_2_3): merge revision(s) 54128: [Backport #12137]

naruse	2016-03-30 01:06:24 +0900 (Wed, 30 Mar 2016)

  New Revision: 54413

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54413

  Log:
    merge revision(s) 54128: [Backport #12137]
    
    * proc.c (proc_binding): proc from symbol can not make a binding.
      [ruby-core:74100] [Bug #12137]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/proc.c
    branches/ruby_2_3/test/ruby/test_symbol.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54412)
+++ ruby_2_3/version.h	(revision 54413)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2016-03-30"
-#define RUBY_PATCHLEVEL 61
+#define RUBY_PATCHLEVEL 62
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54412)
+++ ruby_2_3/ChangeLog	(revision 54413)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Wed Mar 30 01:00:30 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* proc.c (proc_binding): proc from symbol can not make a binding.
+	  [ruby-core:74100] [Bug #12137]
+
 Wed Mar 30 00:54:38 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/win32.h (O_SHARE_DELETE): change to fit Fixnum
Index: ruby_2_3/test/ruby/test_symbol.rb
===================================================================
--- ruby_2_3/test/ruby/test_symbol.rb	(revision 54412)
+++ ruby_2_3/test/ruby/test_symbol.rb	(revision 54413)
@@ -176,6 +176,15 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_symbol.rb#L176
     end;
   end
 
+  def test_to_proc_binding
+    assert_separately([], <<~"end;", timeout: 1) # do
+      bug12137 = '[ruby-core:74100] [Bug #12137]'
+      assert_raise(ArgumentError, bug12137) {
+        :succ.to_proc.binding
+      }
+    end;
+  end
+
   def test_call
     o = Object.new
     def o.foo(x, y); x + y; end
Index: ruby_2_3/proc.c
===================================================================
--- ruby_2_3/proc.c	(revision 54412)
+++ ruby_2_3/proc.c	(revision 54413)
@@ -2646,6 +2646,7 @@ proc_binding(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L2646
     GetProcPtr(self, proc);
     envval = rb_vm_proc_envval(proc);
     iseq = proc->block.iseq;
+    if (SYMBOL_P(iseq)) goto error;
     if (RUBY_VM_IFUNC_P(iseq)) {
 	struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
 	if (IS_METHOD_PROC_IFUNC(ifunc)) {
@@ -2654,6 +2655,7 @@ proc_binding(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L2655
 	    iseq = rb_method_iseq(method);
 	}
 	else {
+	  error:
 	    rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
 	}
     }

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r54128


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]