mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 18:23:42 +00:00
Another 3.x bug involving jumps
This commit is contained in:
parent
109d99bc62
commit
bd809dc08b
BIN
test/bytecode_3.4/10_try_continue_bug.pyc
Normal file
BIN
test/bytecode_3.4/10_try_continue_bug.pyc
Normal file
Binary file not shown.
19
test/simple_source/exception/10_try_continue_bug.py
Normal file
19
test/simple_source/exception/10_try_continue_bug.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Python 3.4 bug found from tempfile.py
|
||||
def _get_default_tempdir(dirlist, fd):
|
||||
for dir in dirlist:
|
||||
for seq in range(100):
|
||||
try:
|
||||
try:
|
||||
try:
|
||||
with open(fd, 'wb', closefd=False) as fp:
|
||||
fp.write(b'blat')
|
||||
finally:
|
||||
seq += 1
|
||||
finally:
|
||||
seq += 10
|
||||
return dir
|
||||
except RuntimeError:
|
||||
pass
|
||||
except OSError:
|
||||
break # no point trying more names in this directory
|
||||
raise RuntimeError
|
@ -265,8 +265,11 @@ class Python3Parser(PythonParser):
|
||||
except_stmt ::= except_pop_except
|
||||
|
||||
# Python3 introduced POP_EXCEPT
|
||||
except_suite ::= c_stmts_opt POP_EXCEPT JUMP_FORWARD
|
||||
except_suite ::= c_stmts_opt POP_EXCEPT jmp_abs
|
||||
except_suite ::= c_stmts_opt POP_EXCEPT jump_except
|
||||
jump_except ::= JUMP_ABSOLUTE
|
||||
jump_except ::= JUMP_BACK
|
||||
jump_except ::= JUMP_FORWARD
|
||||
jump_except ::= CONTINUE
|
||||
|
||||
# This is used in Python 3 in
|
||||
# "except ... as e" to remove 'e' after the c_stmts_opt finishes
|
||||
@ -287,11 +290,9 @@ class Python3Parser(PythonParser):
|
||||
except ::= POP_TOP POP_TOP POP_TOP c_stmts_opt POP_EXCEPT _jump
|
||||
except ::= POP_TOP POP_TOP POP_TOP return_stmts
|
||||
|
||||
|
||||
jmp_abs ::= JUMP_ABSOLUTE
|
||||
jmp_abs ::= JUMP_BACK
|
||||
|
||||
|
||||
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
||||
POP_BLOCK LOAD_CONST COME_FROM
|
||||
WITH_CLEANUP END_FINALLY
|
||||
|
Loading…
Reference in New Issue
Block a user