From fbcdc7a181ad5f735a90d5e9c6dfb28f7222a433 Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 18 May 2016 15:04:06 -0400 Subject: [PATCH] Allow PyPy 2.7 opcodes and magic and ... disas.py: * more aggressive code checking magics.py: * Add PYPY magic opcodes_27.py: * Add PYPY opcodes --- NEWS | 2 +- uncompyle6/disas.py | 2 ++ uncompyle6/magics.py | 1 + uncompyle6/opcodes/opcode_27.py | 12 ++++++------ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index defdd02c..c5abe9d5 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -uncompyle6 2.4.0 2016-05-18 +uncompyle6 2.4.0 2016-05-18 (in memory of Lewis Bernstein) - Many Python 3 bugs fixed: * Python 3.2 to 3.5 libaries largely diff --git a/uncompyle6/disas.py b/uncompyle6/disas.py index 3fc9f71d..13245bf2 100644 --- a/uncompyle6/disas.py +++ b/uncompyle6/disas.py @@ -61,6 +61,8 @@ def disco_loop(disasm, queue, real_out, use_uncompyle6_format): for t in tokens: if iscode(t.pattr): queue.append(t.pattr) + elif iscode(t.attr): + queue.append(t.attr) print(t.format(), file=real_out) pass pass diff --git a/uncompyle6/magics.py b/uncompyle6/magics.py index 57674bdb..cc1680ab 100755 --- a/uncompyle6/magics.py +++ b/uncompyle6/magics.py @@ -53,6 +53,7 @@ versions = { __build_magic(62191): '2.7', # 2.7a0 (introduce SETUP_WITH) __build_magic(62201): '2.7', # 2.7a0 (introduce BUILD_SET) __build_magic(62211): '2.7', # 2.7a0 (introduce MAP_ADD and SET_ADD) + __build_magic(62218): '2.7', # 2.7 pypy? __build_magic(3000): '3.0', # 3.000 __build_magic(3010): '3.0', # 3.000 (removed UNARY_CONVERT) __build_magic(3020): '3.0', # 3.000 (added BUILD_SET) diff --git a/uncompyle6/opcodes/opcode_27.py b/uncompyle6/opcodes/opcode_27.py index 1fb748aa..b7bc72ef 100755 --- a/uncompyle6/opcodes/opcode_27.py +++ b/uncompyle6/opcodes/opcode_27.py @@ -202,12 +202,12 @@ EXTENDED_ARG = 145 def_op('SET_ADD', 146) def_op('MAP_ADD', 147) -from uncompyle6 import IS_PYPY -if IS_PYPY: - def_op('LOOKUP_METHOD', 201) - def_op('CALL_METHOD', 202) - def_op('BUILD_LIST_FROM_ARG', 203) - def_op('JUMP_IF_NOT_DEBUG', 204) +# PyPy magic opcodes +# FIXME: see if we can conditionally add them +def_op('LOOKUP_METHOD', 201) +def_op('CALL_METHOD', 202) +def_op('BUILD_LIST_FROM_ARG', 203) +def_op('JUMP_IF_NOT_DEBUG', 204) updateGlobal() del def_op, name_op, jrel_op, jabs_op