Skip to content

Commit

Permalink
Fix Python generation of function defs
Browse files Browse the repository at this point in the history
Fixes #12.
  • Loading branch information
JukkaL committed Jan 10, 2013
1 parent 9ea5bcd commit 29ee8f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def parse_super_type(self):
parse_function_header(self, Annotation ret_type):
"""Parse function header (a name followed by arguments)

Returns a 9-tuple with the following items:
Returns a 7-tuple with the following items:
name
arguments
initializers
Expand Down Expand Up @@ -467,6 +467,7 @@ def parse_super_type(self):
self.set_repr(var_arg, noderepr.VarRepr(name, none))
args.append(var_arg)
init.append(None)
assigns.append(none)
if isdict:
kinds.append(nodes.ARG_STAR2)
else:
Expand Down
9 changes: 9 additions & 0 deletions test/data/pythongen.test
Original file line number Diff line number Diff line change
Expand Up @@ -511,3 +511,12 @@ def f(x):
return f2(x)
else:
raise TypeError("Invalid argument types")


-- Special cases
-- -------------


[case testOptionalArgAfterAsteriskArg]
# Issue #12
def f(*x, y = 1): pass

0 comments on commit 29ee8f7

Please sign in to comment.