You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
3.5, 3.6 loop if/continue handling
This commit is contained in:
BIN
test/bytecode_3.5_run/01_loop_if_continue.pyc
Normal file
BIN
test/bytecode_3.5_run/01_loop_if_continue.pyc
Normal file
Binary file not shown.
13
test/simple_source/bug35/01_loop_if_continue.py
Normal file
13
test/simple_source/bug35/01_loop_if_continue.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# From 3.6.4 pathlib.py
|
||||||
|
# Bug was handling "continue" as last statement of "if"
|
||||||
|
# RUNNABLE!
|
||||||
|
def parse_parts(it, parts):
|
||||||
|
for part in it:
|
||||||
|
if not part:
|
||||||
|
continue
|
||||||
|
parts = 1
|
||||||
|
return parts
|
||||||
|
|
||||||
|
assert parse_parts([], 5) == 5
|
||||||
|
assert parse_parts([True], 6) == 1
|
||||||
|
assert parse_parts([False], 6) == 6
|
@@ -111,6 +111,12 @@ class Python35Parser(Python34Parser):
|
|||||||
jump_absolute_else ::= jb_else
|
jump_absolute_else ::= jb_else
|
||||||
jump_absolute_else ::= CONTINUE ELSE
|
jump_absolute_else ::= CONTINUE ELSE
|
||||||
|
|
||||||
|
# Our hacky "ELSE" determination doesn't do a good job and really
|
||||||
|
# determine the start of an "else". It could also be the end of an
|
||||||
|
# "if-then" which ends in a "continue". Perhaps with real control-flow
|
||||||
|
# analysis we'll sort this out. Or call "ELSE" something more appropriate.
|
||||||
|
_ifstmts_jump ::= c_stmts_opt ELSE
|
||||||
|
|
||||||
# ifstmt ::= testexpr c_stmts_opt
|
# ifstmt ::= testexpr c_stmts_opt
|
||||||
|
|
||||||
iflaststmt ::= testexpr c_stmts_opt JUMP_FORWARD
|
iflaststmt ::= testexpr c_stmts_opt JUMP_FORWARD
|
||||||
|
Reference in New Issue
Block a user