mirror of
https://github.com/python/cpython.git
synced 2025-09-02 23:18:25 +00:00
* Remove PRINT_ITEM(_TO), PRINT_NEWLINE(_TO) opcodes.
* Fix some docstrings and one Print -> print. * Fix test_{class,code,descrtut,dis,extcall,parser,popen,pkg,subprocess,syntax,traceback}. These were the ones that generated code with a print statement. In most remaining failing tests there's an issue with the soft space.
This commit is contained in:
parent
08c47ba0df
commit
88fc6646d1
31 changed files with 159 additions and 553 deletions
|
@ -1130,29 +1130,6 @@ class CodeGenerator:
|
|||
opcode = callfunc_opcode_info[have_star, have_dstar]
|
||||
self.emit(opcode, kw << 8 | pos)
|
||||
|
||||
def visitPrint(self, node, newline=0):
|
||||
self.set_lineno(node)
|
||||
if node.dest:
|
||||
self.visit(node.dest)
|
||||
for child in node.nodes:
|
||||
if node.dest:
|
||||
self.emit('DUP_TOP')
|
||||
self.visit(child)
|
||||
if node.dest:
|
||||
self.emit('ROT_TWO')
|
||||
self.emit('PRINT_ITEM_TO')
|
||||
else:
|
||||
self.emit('PRINT_ITEM')
|
||||
if node.dest and not newline:
|
||||
self.emit('POP_TOP')
|
||||
|
||||
def visitPrintnl(self, node):
|
||||
self.visitPrint(node, newline=1)
|
||||
if node.dest:
|
||||
self.emit('PRINT_NEWLINE_TO')
|
||||
else:
|
||||
self.emit('PRINT_NEWLINE')
|
||||
|
||||
def visitReturn(self, node):
|
||||
self.set_lineno(node)
|
||||
self.visit(node.value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue