diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | test/ruby/test_symbol.rb | 9 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 17 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Mar 30 01:00:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * include/ruby/win32.h (O_SHARE_DELETE): change to fit Fixnum @@ -2646,6 +2646,7 @@ proc_binding(VALUE self) 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) iseq = rb_method_iseq(method); } else { + error: rb_raise(rb_eArgError, "Can't create Binding from C level Proc"); } } diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index 8960bec0d1..2133573fc3 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -176,6 +176,15 @@ class TestSymbol < Test::Unit::TestCase 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 @@ -1,6 +1,6 @@ #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 |