Skip to content

Commit

Permalink
Merge pull request #815 from scooter-dangle/Proc#arity-with-default-args
Browse files Browse the repository at this point in the history
Calculate Proc#arity the same way as Method#arity
  • Loading branch information
alex committed Jul 31, 2013
2 parents 31f9893 + 5791200 commit 45ab019
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions spec/tags/core/proc/arity_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
fails:Proc#arity returns 1 for a block taking |a, | arguments
fails:Proc#arity returns -1 for a lambda taking one optional argument
fails:Proc#arity returns -2 for a lambda taking |a, b = 0| argument
fails:Proc#arity returns -2 for a lambda taking |a, b = 0, c = 0| argument
fails:Proc#arity returns -2 for a lambda taking |(a, b), c = 0| argument
2 changes: 1 addition & 1 deletion topaz/objects/procobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def method_lambda(self, space):

@classdef.method("arity")
def method_arity(self, space):
return space.newint(self.bytecode.arity())
return space.newint(self.bytecode.arity(negative_defaults=self.is_lambda))

@classdef.method("binding")
def method_binding(self, space):
Expand Down

0 comments on commit 45ab019

Please sign in to comment.