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

ruby-changes:29940

From: glass <ko1@a...>
Date: Tue, 16 Jul 2013 11:22:30 +0900 (JST)
Subject: [ruby-changes:29940] glass:r41992 (trunk): * proc.c (rb_block_arity): raise ArgumentError if no block given.

glass	2013-07-16 11:22:17 +0900 (Tue, 16 Jul 2013)

  New Revision: 41992

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41992

  Log:
    * proc.c (rb_block_arity): raise ArgumentError if no block given.

  Modified files:
    trunk/ChangeLog
    trunk/proc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41991)
+++ ChangeLog	(revision 41992)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul 16 11:12:03 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* proc.c (rb_block_arity): raise ArgumentError if no block given.
+
 Tue Jul 16 08:15:22 2013  Zachary Scott  <e@z...>
 
 	* ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] document top-level
Index: proc.c
===================================================================
--- proc.c	(revision 41991)
+++ proc.c	(revision 41992)
@@ -722,9 +722,11 @@ rb_block_arity(void) https://github.com/ruby/ruby/blob/trunk/proc.c#L722
     rb_thread_t *th = GET_THREAD();
     rb_control_frame_t *cfp = th->cfp;
     rb_block_t *block = rb_vm_control_frame_block_ptr(cfp);
-    VALUE proc_value = block->proc;
+    VALUE proc_value;
 
+    if (!block) rb_raise(rb_eArgError, "no block given");
     min = rb_block_min_max_arity(block, &max);
+    proc_value = block->proc;
     if (proc_value) {
 	rb_proc_t *proc;
 	GetProcPtr(proc_value, proc);

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

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