diff options
Diffstat (limited to 'Tools/parser/unparse.py')
-rw-r--r-- | Tools/parser/unparse.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py index 70b47a1..385902e 100644 --- a/Tools/parser/unparse.py +++ b/Tools/parser/unparse.py @@ -592,14 +592,18 @@ class Unparser: def _arguments(self, t): first = True # normal arguments - defaults = [None] * (len(t.args) - len(t.defaults)) + t.defaults - for a, d in zip(t.args, defaults): + all_args = t.posonlyargs + t.args + defaults = [None] * (len(all_args) - len(t.defaults)) + t.defaults + for index, elements in enumerate(zip(all_args, defaults), 1): + a, d = elements if first:first = False else: self.write(", ") self.dispatch(a) if d: self.write("=") self.dispatch(d) + if index == len(t.posonlyargs): + self.write(", /") # varargs, or bare '*' if no varargs but keyword-only arguments present if t.vararg or t.kwonlyargs: |