summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--proc.c2
-rw-r--r--test/ruby/test_symbol.rb9
-rw-r--r--version.h2
4 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b6bd2664c3..e271907ee4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/proc.c b/proc.c
index 6d153c1b3e..980142174b 100644
--- a/proc.c
+++ b/proc.c
@@ -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
diff --git a/version.h b/version.h
index dc26fda268..9789b5c9b4 100644
--- a/version.h
+++ b/version.h
@@ -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