summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 07:16:14 (GMT)
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 07:16:14 (GMT)
commit94b3c4121bce5b7a9a181a10bc1a9f31fa6f4940 (patch)
tree8495f30e4255f69403c40f3a94f72ac66245b70e /proc.c
parent61c19c9d433f5855bc9e536bfa8d8c4e140157bd (diff)
* proc.c (rb_block_arity): should not call GetProcPtr() for symbols.
[ruby-core:72205] [Bug #11830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/proc.c b/proc.c
index a43c798..b8b2145 100644
--- a/proc.c
+++ b/proc.c
@@ -956,10 +956,15 @@ rb_block_arity(void)
min = rb_block_min_max_arity(block, &max);
proc_value = block->proc;
if (proc_value) {
- rb_proc_t *proc;
- GetProcPtr(proc_value, proc);
- if (proc)
- return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
+ if (SYMBOL_P(proc_value)) {
+ return -1;
+ }
+ else {
+ rb_proc_t *proc;
+ GetProcPtr(proc_value, proc);
+ if (proc)
+ return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
+ }
}
return max != UNLIMITED_ARGUMENTS ? min : -min-1;
}