mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fix the compiler package w.r.t. the new metaclass syntax.
(It is still broken w.r.t. the new nonlocal keyword.) Remove a series of debug prints I accidentally left in test_ast.py.
This commit is contained in:
parent
801dd73653
commit
d16e81aabe
7 changed files with 40 additions and 30 deletions
|
@ -288,16 +288,16 @@ class Transformer:
|
|||
old_lambdef = lambdef
|
||||
|
||||
def classdef(self, nodelist):
|
||||
# classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
|
||||
# classdef: 'class' NAME ['(' [arglist] ')'] ':' suite
|
||||
|
||||
name = nodelist[1][1]
|
||||
doc = self.get_docstring(nodelist[-1])
|
||||
if nodelist[2][0] == token.COLON:
|
||||
bases = []
|
||||
arglist = CallFunc(None, [])
|
||||
elif nodelist[3][0] == token.RPAR:
|
||||
bases = []
|
||||
arglist = CallFunc(None, [])
|
||||
else:
|
||||
bases = self.com_bases(nodelist[3])
|
||||
arglist = self.com_call_function(None, nodelist[3])
|
||||
|
||||
# code for class
|
||||
code = self.com_node(nodelist[-1])
|
||||
|
@ -307,7 +307,8 @@ class Transformer:
|
|||
assert isinstance(code.nodes[0], Discard)
|
||||
del code.nodes[0]
|
||||
|
||||
return Class(name, bases, doc, code, lineno=nodelist[1][2])
|
||||
return Class(name, arglist.args, arglist.star_args, arglist.dstar_args,
|
||||
doc, code, lineno=nodelist[1][2])
|
||||
|
||||
def stmt(self, nodelist):
|
||||
return self.com_stmt(nodelist[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue