You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
More 3.0 control flow pattern fixups
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
# Adapted from 3.0 base64
|
# Adapted from 3.0 base64
|
||||||
# Problem was handling if/else which
|
# Problem was handling if/else which
|
||||||
# needs to be like Python 2.6 (and not like 2.7 or 3.1)
|
# needs to be like Python 2.6 (and not like 2.7 or 3.1)
|
||||||
def main(args, f):
|
def main(args, f, func, sys):
|
||||||
"""Small main program"""
|
"""Small main program"""
|
||||||
if args and args[0] != '-':
|
if args and args[0] != '-':
|
||||||
func(f, sys.stdout.buffer)
|
func(f, sys.stdout.buffer)
|
||||||
@@ -24,7 +24,14 @@ def parse_marked_section(fn, i, rawdata, report=1):
|
|||||||
# in its gen_comp_body, we can use COME_FROM in its place.
|
# in its gen_comp_body, we can use COME_FROM in its place.
|
||||||
# As above omission of JUMPs is a feature of 3.0 that doesn't
|
# As above omission of JUMPs is a feature of 3.0 that doesn't
|
||||||
# seem to be in later versions (or earlier like 2.6).
|
# seem to be in later versions (or earlier like 2.6).
|
||||||
def __and__(self, other):
|
def __and__(self, other, Iterable):
|
||||||
if not isinstance(other, Iterable):
|
if not isinstance(other, Iterable):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return self._from_iterable(value for value in other if value in self)
|
return self._from_iterable(value for value in other if value in self)
|
||||||
|
|
||||||
|
# Adapted from 3.0.1 abc.py
|
||||||
|
# Bug was in handling multiple COME_FROMs in return_if_stmt
|
||||||
|
def __instancecheck__(subtype, subclass, cls):
|
||||||
|
if subtype:
|
||||||
|
if (cls and subclass):
|
||||||
|
return False
|
||||||
|
@@ -136,7 +136,7 @@ class Python30Parser(Python31Parser):
|
|||||||
except_handler ::= jmp_abs COME_FROM_EXCEPT except_stmts
|
except_handler ::= jmp_abs COME_FROM_EXCEPT except_stmts
|
||||||
POP_TOP END_FINALLY
|
POP_TOP END_FINALLY
|
||||||
|
|
||||||
return_if_stmt ::= ret_expr RETURN_END_IF COME_FROM POP_TOP
|
return_if_stmt ::= ret_expr RETURN_END_IF come_froms POP_TOP
|
||||||
and ::= expr jmp_false expr come_from_opt
|
and ::= expr jmp_false expr come_from_opt
|
||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt come_from_opt
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt come_from_opt
|
||||||
JUMP_BACK come_froms POP_TOP POP_BLOCK COME_FROM_LOOP
|
JUMP_BACK come_froms POP_TOP POP_BLOCK COME_FROM_LOOP
|
||||||
|
Reference in New Issue
Block a user