mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +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
|
@ -435,13 +435,10 @@ class CodeGenerator:
|
|||
walk(node.code, gen)
|
||||
gen.finish()
|
||||
self.set_lineno(node)
|
||||
self.emit('LOAD_CONST', node.name)
|
||||
for base in node.bases:
|
||||
self.visit(base)
|
||||
self.emit('BUILD_TUPLE', len(node.bases))
|
||||
self.emit('LOAD_BUILD_CLASS')
|
||||
self._makeClosure(gen, 0)
|
||||
self.emit('CALL_FUNCTION', 0)
|
||||
self.emit('BUILD_CLASS')
|
||||
self.emit('LOAD_CONST', node.name)
|
||||
self.finish_visit_call(node, 2)
|
||||
self.storeName(node.name)
|
||||
|
||||
# The rest are standard visitor methods
|
||||
|
@ -1115,10 +1112,11 @@ class CodeGenerator:
|
|||
self.emit('STORE_SUBSCR')
|
||||
|
||||
def visitCallFunc(self, node):
|
||||
pos = 0
|
||||
kw = 0
|
||||
self.set_lineno(node)
|
||||
self.visit(node.node)
|
||||
self.finish_visit_call(node)
|
||||
|
||||
def finish_visit_call(self, node, pos=0, kw=0):
|
||||
for arg in node.args:
|
||||
self.visit(arg)
|
||||
if isinstance(arg, ast.Keyword):
|
||||
|
@ -1467,7 +1465,7 @@ class AbstractClassCode:
|
|||
|
||||
def finish(self):
|
||||
self.graph.startExitBlock()
|
||||
self.emit('LOAD_LOCALS')
|
||||
self.emit('LOAD_CONST', None)
|
||||
self.emit('RETURN_VALUE')
|
||||
|
||||
class ClassCodeGenerator(NestedScopeMixin, AbstractClassCode, CodeGenerator):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue