Skip to content

Commit 3b12b75

Browse files
committed
merge revision(s) 44433: [Backport ruby#9299]
* proc.c: Having any mandatory keyword argument increases min arity [ruby#9299] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent ba39ed7 commit 3b12b75

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Sat Mar 1 17:25:12 2014 Marc-Andre Lafortune <[email protected]>
2+
3+
* proc.c: Having any mandatory keyword argument increases min arity
4+
[#9299]
5+
16
Mon Feb 24 14:56:41 2014 WATANABE Hirofumi <[email protected]>
27

38
* tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]

proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
828828
*max = (iseq->arg_rest == -1 && iseq->arg_keyword == -1) ?
829829
iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
830830
: UNLIMITED_ARGUMENTS;
831-
return iseq->argc + iseq->arg_post_len;
831+
return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
832832
}
833833

834834
static int

test/ruby/test_proc.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ def test_arity
8585
assert_equal(-3, proc{|x, y=0, z, **o|}.arity)
8686
assert_equal(-3, proc{|x, y=0, *z, w, **o|}.arity)
8787

88+
assert_equal(2, proc{|x, y=0, z, a:1|}.arity)
89+
assert_equal(3, proc{|x, y=0, z, a:|}.arity)
90+
assert_equal(-4, proc{|x, y, *rest, a:, b:, c:|}.arity)
91+
assert_equal(3, proc{|x, y=0, z, a:, **o|}.arity)
92+
8893
assert_equal(0, lambda{}.arity)
8994
assert_equal(0, lambda{||}.arity)
9095
assert_equal(1, lambda{|x|}.arity)

version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.1.2"
2-
#define RUBY_RELEASE_DATE "2014-02-24"
3-
#define RUBY_PATCHLEVEL 77
2+
#define RUBY_RELEASE_DATE "2014-03-01"
3+
#define RUBY_PATCHLEVEL 78
44

55
#define RUBY_RELEASE_YEAR 2014
6-
#define RUBY_RELEASE_MONTH 2
7-
#define RUBY_RELEASE_DAY 24
6+
#define RUBY_RELEASE_MONTH 3
7+
#define RUBY_RELEASE_DAY 1
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)