diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | proc.c | 18 |
2 files changed, 9 insertions, 14 deletions
@@ -7,11 +7,6 @@ Thu Dec 1 22:31:16 2011 Tanaka Akira <akr@fsij.org> * io.c (linux_get_maxfd): change local variable name. -Thu Dec 1 20:33:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca> - - * proc.c (rb_proc_arity): Fix Proc#arity in case of optional - arguments. [bug #5694] [rubyspec:b8b259] - Thu Dec 1 16:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> * ext/socket/extconf.rb: add arguments for macro calls. @@ -615,14 +615,14 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval) * arguments. A <code>proc</code> with no argument declarations * is the same a block declaring <code>||</code> as its arguments. * - * Proc.new {}.arity #=> 0 - * Proc.new {||}.arity #=> 0 - * Proc.new {|a|}.arity #=> 1 - * Proc.new {|a, b|}.arity #=> 2 - * Proc.new {|a, b, c|}.arity #=> 3 - * Proc.new {|*a|}.arity #=> -1 - * Proc.new {|a, b=42|}.arity #=> -2 - * Proc.new {|a, *b, c|}.arity #=> -3 + * Proc.new {}.arity #=> 0 + * Proc.new {||}.arity #=> 0 + * Proc.new {|a|}.arity #=> 1 + * Proc.new {|a,b|}.arity #=> 2 + * Proc.new {|a,b,c|}.arity #=> 3 + * Proc.new {|*a|}.arity #=> -1 + * Proc.new {|a,*b|}.arity #=> -2 + * Proc.new {|a,*b, c|}.arity #=> -3 */ static VALUE @@ -641,7 +641,7 @@ rb_proc_arity(VALUE self) iseq = proc->block.iseq; if (iseq) { if (BUILTIN_TYPE(iseq) != T_NODE) { - if (iseq->arg_rest < 0 && iseq->arg_opts == 0) { + if (iseq->arg_rest < 0) { return iseq->argc; } else { |