Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7708d69

Browse files
committed
add varargs and kwargs flags to Lambda nodes
1 parent 873bdc1 commit 7708d69

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/compiler/ast.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def __init__(self, argnames, defaults, flags, code):
105105
self.flags = flags
106106
self.code = code
107107
self._children = ('lambda', argnames, defaults, flags, code)
108+
self.varargs = self.kwargs = None
109+
if flags & CO_VARARGS:
110+
self.varargs = 1
111+
if flags & CO_VARKEYWORDS:
112+
self.kwargs = 1
108113

109114
def __repr__(self):
110115
return "Lambda(%s,%s,%s,%s)" % self._children[1:]

Tools/compiler/compiler/ast.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def __init__(self, argnames, defaults, flags, code):
105105
self.flags = flags
106106
self.code = code
107107
self._children = ('lambda', argnames, defaults, flags, code)
108+
self.varargs = self.kwargs = None
109+
if flags & CO_VARARGS:
110+
self.varargs = 1
111+
if flags & CO_VARKEYWORDS:
112+
self.kwargs = 1
108113

109114
def __repr__(self):
110115
return "Lambda(%s,%s,%s,%s)" % self._children[1:]

0 commit comments

Comments
 (0)