You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fix 3.1 and 3.2 named and kwargs parsing..
Improve 3.4 coverage and note a 3.5 while bug
This commit is contained in:
BIN
test/bytecode_3.1/02_named_and_kwargs.pyc
Normal file
BIN
test/bytecode_3.1/02_named_and_kwargs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.2/02_named_and_kwargs.pyc
Normal file
BIN
test/bytecode_3.2/02_named_and_kwargs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.4/06_while_return.pyc
Normal file
BIN
test/bytecode_3.4/06_while_return.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.5/06_while_return.pyc
Normal file
BIN
test/bytecode_3.5/06_while_return.pyc
Normal file
Binary file not shown.
28
test/simple_source/bug35/06_while_return.py
Normal file
28
test/simple_source/bug35/06_while_return.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# From Python 3.4 asynchat.py
|
||||
# Tests presence or absense of
|
||||
# SETUP_LOOP testexpr return_stmts POP_BLOCK COME_FROM_LOOP
|
||||
|
||||
def initiate_send(self, num_sent, first):
|
||||
while self.producer_fifo and self.connected:
|
||||
try:
|
||||
5
|
||||
except OSError:
|
||||
return
|
||||
|
||||
if num_sent:
|
||||
if first:
|
||||
self.producer_fifo = '6'
|
||||
else:
|
||||
del self.producer_fifo[0]
|
||||
return
|
||||
|
||||
|
||||
# FIXME: this causes a parse error:
|
||||
# def initiate_send(self):
|
||||
# while self.producer_fifo and self.connected:
|
||||
# try:
|
||||
# 6
|
||||
# except OSError:
|
||||
# return
|
||||
|
||||
# return
|
@@ -815,8 +815,8 @@ class Python3Parser(PythonParser):
|
||||
|
||||
# Note order of kwargs and pos args changed between 3.3-3.4
|
||||
if self.version <= 3.2:
|
||||
rule = ('mkfunc ::= %sload_closure LOAD_CONST kwargs %s'
|
||||
% (kwargs_str, ('expr ' * args_pos, opname)))
|
||||
rule = ('mkfunc ::= %s%sload_closure LOAD_CONST kwargs %s'
|
||||
% (kwargs_str, 'expr ' * args_pos, opname))
|
||||
elif self.version == 3.3:
|
||||
rule = ('mkfunc ::= %s%sload_closure LOAD_CONST LOAD_CONST %s'
|
||||
% (kwargs_str, 'expr ' * args_pos, opname))
|
||||
@@ -899,7 +899,12 @@ class Python3Parser(PythonParser):
|
||||
opname))
|
||||
self.add_make_function_rule(rule_pat, opname, token.attr, customize)
|
||||
|
||||
if self.version == 3.3:
|
||||
if self.version < 3.3:
|
||||
# positional args after keyword args
|
||||
rule = ('mkfunc ::= kwargs %s%s %s' %
|
||||
('pos_arg ' * args_pos, 'LOAD_CONST ',
|
||||
opname))
|
||||
elif self.version == 3.3:
|
||||
# positional args after keyword args
|
||||
rule = ('mkfunc ::= kwargs %s%s %s' %
|
||||
('pos_arg ' * args_pos, 'LOAD_CONST '*2,
|
||||
|
@@ -25,6 +25,7 @@ class Python35Parser(Python34Parser):
|
||||
while1stmt ::= SETUP_LOOP l_stmts POP_BLOCK COME_FROM_LOOP
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK
|
||||
POP_BLOCK else_suite COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr return_stmts POP_BLOCK COME_FROM_LOOP
|
||||
|
||||
# The following rule is for Python 3.5+ where we can have stuff like
|
||||
# while ..
|
||||
|
Reference in New Issue
Block a user