diff options
Diffstat (limited to 'Lib/compiler/ast.py')
-rw-r--r-- | Lib/compiler/ast.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py index 0be36a4..d21905f 100644 --- a/Lib/compiler/ast.py +++ b/Lib/compiler/ast.py @@ -487,11 +487,12 @@ class From(Node): return "From(%s, %s, %s)" % (repr(self.modname), repr(self.names), repr(self.level)) class Function(Node): - def __init__(self, decorators, name, argnames, defaults, flags, doc, code, lineno=None): + def __init__(self, decorators, name, argnames, defaults, kwonlyargs, flags, doc, code, lineno=None): self.decorators = decorators self.name = name self.argnames = argnames self.defaults = defaults + self.kwonlyargs = kwonlyargs self.flags = flags self.doc = doc self.code = code @@ -509,6 +510,7 @@ class Function(Node): children.append(self.name) children.append(self.argnames) children.extend(flatten(self.defaults)) + children.append(self.kwonlyargs) children.append(self.flags) children.append(self.doc) children.append(self.code) @@ -523,7 +525,7 @@ class Function(Node): return tuple(nodelist) def __repr__(self): - return "Function(%s, %s, %s, %s, %s, %s, %s)" % (repr(self.decorators), repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.doc), repr(self.code)) + return "Function(%s, %s, %s, %s, %s, %s, %s, %s)" % (repr(self.decorators), repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.kwonlyargs), repr(self.flags), repr(self.doc), repr(self.code)) class GenExpr(Node): def __init__(self, code, lineno=None): @@ -531,6 +533,7 @@ class GenExpr(Node): self.lineno = lineno self.argnames = ['.0'] self.varargs = self.kwargs = None + self.kwonlyargs = () def getChildren(self): @@ -713,9 +716,10 @@ class Keyword(Node): return "Keyword(%s, %s)" % (repr(self.name), repr(self.expr)) class Lambda(Node): - def __init__(self, argnames, defaults, flags, code, lineno=None): + def __init__(self, argnames, defaults, kwonlyargs, flags, code, lineno=None): self.argnames = argnames self.defaults = defaults + self.kwonlyargs = kwonlyargs self.flags = flags self.code = code self.lineno = lineno @@ -730,6 +734,7 @@ class Lambda(Node): children = [] children.append(self.argnames) children.extend(flatten(self.defaults)) + children.append(self.kwonlyargs) children.append(self.flags) children.append(self.code) return tuple(children) @@ -741,7 +746,7 @@ class Lambda(Node): return tuple(nodelist) def __repr__(self): - return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code)) + return "Lambda(%s, %s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.kwonlyargs), repr(self.flags), repr(self.code)) class LeftShift(Node): def __init__(self, (left, right), lineno=None): |