summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-01 12:01:29 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-01 12:01:29 +0000
commitb8b43fbdbea07bfa8e0f2d3ca65871d80b7c903e (patch)
tree203d6832ec5bef116d35898d9b981576822fef2e /proc.c
parent4b6a0ae306f995d7bec668cf8e046c01defc641b (diff)
merge revision(s) 44432: [Backport #9299]
* proc.c: Having optional keyword arguments makes maximum arity +1, not unlimited [#8072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/proc.c b/proc.c
index 9c88ada316..e3cecb7bbe 100644
--- a/proc.c
+++ b/proc.c
@@ -825,8 +825,9 @@ proc_arity(VALUE self)
static inline int
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)
+ *max = iseq->arg_rest == -1 ?
+ iseq->argc + iseq->arg_post_len + iseq->arg_opts -
+ (iseq->arg_opts > 0) + (iseq->arg_keyword != -1)
: UNLIMITED_ARGUMENTS;
return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
}