summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-01 08:25:29 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-01 08:25:29 +0000
commit7a620ac5306bd5cb44fbd5a0ecefed3a63410046 (patch)
tree1fc77e52dbc561669724da1c0f3da609ffa4ddd1
parent038540f9319b5b8fb7d4b809f82e1da63c47c0ba (diff)
merge revision(s) 44433: [Backport #9299]
* proc.c: Having any mandatory keyword argument increases min arity [#9299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--proc.c2
-rw-r--r--test/ruby/test_proc.rb5
-rw-r--r--version.h8
4 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f929ba566..f2592eb9f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Mar 1 17:25:12 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * proc.c: Having any mandatory keyword argument increases min arity
+ [#9299]
+
Mon Feb 24 14:56:41 2014 WATANABE Hirofumi <eban@ruby-lang.org>
* tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]
diff --git a/proc.c b/proc.c
index 78851ac547..9c88ada316 100644
--- a/proc.c
+++ b/proc.c
@@ -828,7 +828,7 @@ rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
*max = (iseq->arg_rest == -1 && iseq->arg_keyword == -1) ?
iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
: UNLIMITED_ARGUMENTS;
- return iseq->argc + iseq->arg_post_len;
+ return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
}
static int
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 206e21fb1a..9e8fb06d6d 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -85,6 +85,11 @@ class TestProc < Test::Unit::TestCase
assert_equal(-3, proc{|x, y=0, z, **o|}.arity)
assert_equal(-3, proc{|x, y=0, *z, w, **o|}.arity)
+ assert_equal(2, proc{|x, y=0, z, a:1|}.arity)
+ assert_equal(3, proc{|x, y=0, z, a:|}.arity)
+ assert_equal(-4, proc{|x, y, *rest, a:, b:, c:|}.arity)
+ assert_equal(3, proc{|x, y=0, z, a:, **o|}.arity)
+
assert_equal(0, lambda{}.arity)
assert_equal(0, lambda{||}.arity)
assert_equal(1, lambda{|x|}.arity)
diff --git a/version.h b/version.h
index dfd09b9312..8c8f900688 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.2"
-#define RUBY_RELEASE_DATE "2014-02-24"
-#define RUBY_PATCHLEVEL 77
+#define RUBY_RELEASE_DATE "2014-03-01"
+#define RUBY_PATCHLEVEL 78
#define RUBY_RELEASE_YEAR 2014
-#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_MONTH 3
+#define RUBY_RELEASE_DAY 1
#include "ruby/version.h"