mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
move constants out of transformer so that they can be shared with ast
add varargs and kwargs attributes to Function nodes
This commit is contained in:
parent
69e2c6efbb
commit
9605c11c4c
4 changed files with 18 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
|||
import types
|
||||
from consts import CO_VARARGS, CO_VARKEYWORDS
|
||||
|
||||
nodes = {}
|
||||
|
||||
|
@ -85,6 +86,12 @@ class Function(Node):
|
|||
self.code = code
|
||||
self._children = ('function',
|
||||
name, argnames, defaults, flags, doc, code)
|
||||
self.varargs = self.kwargs = None
|
||||
if flags & CO_VARARGS:
|
||||
self.varargs = 1
|
||||
if flags & CO_VARKEYWORDS:
|
||||
self.kwargs = 1
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "Function(%s,%s,%s,%s,%s,%s)" % self._children[1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue