mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-23 05:00:07 +00:00
2.5/2.6 RETURN_VALUE bug
This commit is contained in:
parent
b640d42113
commit
e020f8f9a9
BIN
test/bytecode_2.5/11_return_val.pyc
Normal file
BIN
test/bytecode_2.5/11_return_val.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.6/11_return_val.pyc
Normal file
BIN
test/bytecode_2.6/11_return_val.pyc
Normal file
Binary file not shown.
13
test/simple_source/stmts/11_return_val.py
Normal file
13
test/simple_source/stmts/11_return_val.py
Normal file
@ -0,0 +1,13 @@
|
||||
# 2.5.6 decimal.py
|
||||
# Bug on 2.5 and 2.6 by incorrectly changing opcode to
|
||||
# RETURN_VALUE to psuedo op: RETURN_END_IF
|
||||
def _formatparam(param, value=None, quote=True):
|
||||
if value is not None and len(value) > 0:
|
||||
if isinstance(value, tuple):
|
||||
value = 'a'
|
||||
if quote or param:
|
||||
pass
|
||||
else:
|
||||
return '%s=%s' % (param, value)
|
||||
else:
|
||||
return param
|
@ -720,7 +720,8 @@ class Scanner2(scan.Scanner):
|
||||
self.structs.append({'type': 'if-then',
|
||||
'start': start,
|
||||
'end': rtarget})
|
||||
self.return_end_ifs.add(pre_rtarget)
|
||||
if self.version == 2.7 or code[pre_rtarget+1] != self.opc.JUMP_FORWARD:
|
||||
self.return_end_ifs.add(pre_rtarget)
|
||||
|
||||
elif op in self.pop_jump_if_or_pop:
|
||||
target = self.get_target(pos, op)
|
||||
|
@ -219,9 +219,6 @@ class Scanner26(scan.Scanner2):
|
||||
pattr = repr(offset + 3 + oparg)
|
||||
if op == self.opc.JUMP_FORWARD:
|
||||
target = self.get_target(offset)
|
||||
if target > offset and self.code[target] == self.opc.RETURN_VALUE:
|
||||
# Python 2.5 sometimes has this
|
||||
op_name = 'JUMP_RETURN'
|
||||
# FIXME: this is a hack to catch stuff like:
|
||||
# if x: continue
|
||||
# the "continue" is not on a new line.
|
||||
|
Loading…
Reference in New Issue
Block a user