mirror of
https://github.com/python/cpython.git
synced 2025-10-18 04:38:07 +00:00
patches from Mark Hammond
Attached is a set of diffs for the .py compiler that adds support for the new extended call syntax. compiler/ast.py: CallFunc node gets 2 new children to support extended call syntax - "star_args" (for "*args") and "dstar_args" (for "**args") compiler/pyassem.py It appear that self.lnotab is supposed to be responsible for tracking line numbers, but self.firstlineno was still hanging around. Removed self.firstlineno completely. NOTE - I didnt actually test that the generated code has the correct line numbers!! Stack depth tracking appeared a little broken - the checks never made it beyond the "self.patterns" check - thus, the custom methods were never called! Fixed this. (XXX Jeremy notes: I think this code is still broken because it doesn't track stack effects across block bounaries.) Added support for the new extended call syntax opcodes for depth calculations. compiler/pycodegen.py Added support for the new extended call syntax opcodes. compiler/transformer.py Added support for the new extended call syntax.
This commit is contained in:
parent
0a4f1ff64e
commit
be317e615e
8 changed files with 116 additions and 28 deletions
|
@ -445,13 +445,15 @@ class Getattr(Node):
|
|||
class CallFunc(Node):
|
||||
nodes['call_func'] = 'CallFunc'
|
||||
|
||||
def __init__(self, node, args):
|
||||
def __init__(self, node, args, star_args = None, dstar_args = None):
|
||||
self.node = node
|
||||
self.args = args
|
||||
self._children = ('call_func', node, args)
|
||||
self.star_args = star_args
|
||||
self.dstar_args = dstar_args
|
||||
self._children = ('call_func', node, args, star_args, dstar_args)
|
||||
|
||||
def __repr__(self):
|
||||
return "CallFunc(%s,%s)" % self._children[1:]
|
||||
return "CallFunc(%s,%s,*%s, **%s)" % self._children[1:]
|
||||
|
||||
class Keyword(Node):
|
||||
nodes['keyword'] = 'Keyword'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue