You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 16:59:52 +08:00
Misc bugs
parse2.py: restore accidently-removed while1stmt rule scanner27.py: grammar typo check_ast: add while1else to list of looping constructs pysource.py: CALL_FUNCTION_VAR_KW_ARGS with positional args rule is different?
This commit is contained in:
@@ -41,6 +41,7 @@ class Python2Parser(PythonParser):
|
||||
def p_stmt2(self, args):
|
||||
"""
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
||||
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
|
||||
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK COME_FROM
|
||||
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK else_suite COME_FROM
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015, 2016 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2017 by Rocky Bernstein
|
||||
"""
|
||||
Python 2.7 bytecode ingester.
|
||||
|
||||
@@ -48,7 +48,7 @@ class Scanner27(Scanner2):
|
||||
self.opc.DELETE_SLICE_2, self.opc.DELETE_SLICE_3,
|
||||
])
|
||||
|
||||
# opcodes with expect a variable number pushed values whose
|
||||
# opcodes which expect a variable number pushed values and whose
|
||||
# count is in the opcode. For parsing we generally change the
|
||||
# opcode name to include that number.
|
||||
varargs_ops = set([
|
||||
|
@@ -10,7 +10,7 @@ before reduction and don't reduce when there is a problem.
|
||||
|
||||
def checker(ast, in_loop, errors):
|
||||
in_loop = in_loop or ast.type in ('while1stmt', 'whileTruestmt',
|
||||
'whilestmt', 'whileelsestmt',
|
||||
'whilestmt', 'whileelsestmt', 'while1elsestmt',
|
||||
'for_block')
|
||||
if ast.type in ('augassign1', 'augassign2') and ast[0][0] == 'and':
|
||||
text = str(ast)
|
||||
|
@@ -1786,7 +1786,9 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
str += '*%c, **%c)'
|
||||
# Python 3.5 only puts optional args (the VAR part)
|
||||
# lowest down the stack
|
||||
if self.version == 3.5:
|
||||
na = (v & 0xff) # positional parameters
|
||||
if self.version == 3.5 and na == 0:
|
||||
print("XXX", k)
|
||||
if p2[2]: p2 = (2, -2, ', ')
|
||||
entry = (str, 0, p2, 1, -2)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user