You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Merge branch 'master' into python-2.4
This commit is contained in:
Binary file not shown.
BIN
test/bytecode_2.7/04_loop_try_else.pyc
Normal file
BIN
test/bytecode_2.7/04_loop_try_else.pyc
Normal file
Binary file not shown.
@@ -12,3 +12,14 @@ def test_specific_values(self):
|
||||
self = 2
|
||||
|
||||
self = 3
|
||||
|
||||
# From 2.6 test_decorators.
|
||||
# Bug was thinking an "except" was some sort of if/then
|
||||
def call(*args):
|
||||
try:
|
||||
return 5
|
||||
except KeyError:
|
||||
return 2
|
||||
except TypeError:
|
||||
# Unhashable argument
|
||||
return 3
|
||||
|
12
test/simple_source/bug27+/04_loop_try_else.py
Normal file
12
test/simple_source/bug27+/04_loop_try_else.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# From Python 2.7 ihooks.py
|
||||
def ensure_fromlist(self, fromlist):
|
||||
for sub in fromlist:
|
||||
if sub:
|
||||
if not recursive:
|
||||
try:
|
||||
all = 5
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
all = 6
|
||||
continue
|
@@ -44,13 +44,11 @@ case $PYVERSION in
|
||||
2.6)
|
||||
SKIP_TESTS=(
|
||||
[test_grp.py]=1 # Long test - might work Control flow?
|
||||
[test_opcodes.py]=1
|
||||
[test_pwd.py]=1 # Long test - might work? Control flow?
|
||||
[test_re.py]=1 # Probably Control flow?
|
||||
[test_trace.py]=1 # Line numbers are expected to be different
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/lib2to3/refactor.pyc
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/mailbox.pyc
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/markupbase.pyc
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/pstats.pyc
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/pyclbr.pyc
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/quopri.pyc -- look at ishex, is short
|
||||
# .pyenv/versions/2.6.9/lib/python2.6/random.pyc
|
||||
|
@@ -50,6 +50,9 @@ class Python27Parser(Python2Parser):
|
||||
tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
except_handler else_suite COME_FROM
|
||||
|
||||
tryelsestmtl ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
|
||||
except_handler else_suitel JUMP_BACK COME_FROM
|
||||
|
||||
except_stmt ::= except_cond2 except_suite
|
||||
|
||||
except_cond1 ::= DUP_TOP expr COMPARE_OP
|
||||
|
@@ -898,7 +898,6 @@ class Scanner2(Scanner):
|
||||
self.structs.append({'type': 'if-then',
|
||||
'start': start-3,
|
||||
'end': pre_rtarget})
|
||||
|
||||
self.thens[start] = end
|
||||
elif jump_op == 'JUMP_ABSOLUTE':
|
||||
if_then_maybe = {'type': 'if-then',
|
||||
@@ -941,13 +940,20 @@ class Scanner2(Scanner):
|
||||
'end': end})
|
||||
elif code_pre_rtarget == self.opc.RETURN_VALUE:
|
||||
if self.version == 2.7 or pre_rtarget not in self.ignore_if:
|
||||
self.structs.append({'type': 'if-then',
|
||||
'start': start,
|
||||
'end': rtarget})
|
||||
self.thens[start] = rtarget
|
||||
if self.version == 2.7 or code[pre_rtarget+1] != self.opc.JUMP_FORWARD:
|
||||
self.fixed_jumps[offset] = rtarget
|
||||
self.return_end_ifs.add(pre_rtarget)
|
||||
# 10 is exception-match. If there is an exception match in the
|
||||
# compare, then this is an exception clause not an if-then clause
|
||||
if (self.code[self.prev[offset]] != self.opc.COMPARE_OP or
|
||||
self.code[self.prev[offset]+1] != 10):
|
||||
self.structs.append({'type': 'if-then',
|
||||
'start': start,
|
||||
'end': rtarget})
|
||||
self.thens[start] = rtarget
|
||||
if self.version == 2.7 or code[pre_rtarget+1] != self.opc.JUMP_FORWARD:
|
||||
self.fixed_jumps[offset] = rtarget
|
||||
self.return_end_ifs.add(pre_rtarget)
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
|
||||
elif op in self.pop_jump_if_or_pop:
|
||||
target = self.get_target(offset, op)
|
||||
|
Reference in New Issue
Block a user