Add 3.5 matrix mult ops

We now run 3.5 verifycation so we need to remove some
of the tests that fail to verify pending fixing.
This commit is contained in:
rocky 2016-07-15 12:12:19 -04:00
parent accc959b71
commit cd8cbf9200
9 changed files with 19 additions and 9 deletions

View File

@ -20,8 +20,10 @@ Why this?
There were a number of decompyle, uncompile, uncompyle2, uncompyle3
forks around. All of them come basically from the same code base, and
almost all of them not maintained very well. This code pulls these together
and addresses a number of open issues in those.
almost all of them no longer maintained or worked on. Only one handled
Python 3, and even there, only 3.2. This code pulls these together,
handles a wide range of bytecodes and addresses a number of open
issues in previous forks.
What makes this different from other CPython bytecode decompilers? Its
ability to deparse just fragments and give source-code information
@ -85,7 +87,7 @@ Known Bugs/Restrictions
-----------------------
Python 2 deparsing decompiles and verifies from Python 2.3.7 to Python
3.5.1 on the standard library packages I have on my system.
3.4.2 on the standard library packages I have on my system.
(Verification is the process of decompiling bytecode, compiling with a
Python for that byecode version, and then comparing the byetcode
@ -96,13 +98,9 @@ Later distributions average about 200 files. At this point, 2.7
decompilation is better than uncompyle2. A number of bugs have been
fixed.
That said, I'm sure down the line more problems will turn up. The
decompilation process uses a number of heuristics that may prove
faulty.
There are a few constructs that still need to be added to Python 3.5.
Python 3.5 largely works, but still has some bugs in it.
Python 3.6 changes things drastically by using word codes rather than
byte codes. So that will be yet another challenge.
byte codes, and that needs to be addressed.
There is lots to do, so please dig in and help.

View File

@ -36,6 +36,7 @@ check-3.4: check-bytecode check-3.4-ok check-2.7-ok
#: Run working tests from Python 3.5
check-3.5: check-bytecode
$(PYTHON) test_pythonlib.py --bytecode-3.5 --verify $(COMPILE)
#: Check deparsing only, but from a different Python version
check-disasm:

Binary file not shown.

View File

@ -0,0 +1,7 @@
# Tests Python 3.5+'s ops
# BINARY_MATRIX_MULTIPLY and INPLACE_MATRIX_MULTIPLY
# code taken from pycdc tests/35_matrix_mult_oper.pyc.src
m = [1, 2] @ [3, 4]
m @= [5, 6]

View File

@ -602,6 +602,8 @@ class Python35onParser(Python3Parser):
POP_BLOCK LOAD_CONST COME_FROM
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
inplace_op ::= INPLACE_MATRIX_MULTIPLY
binary_op ::= BINARY_MATRIX_MULTIPLY
# Python 3.5+ does jump optimization
# In <.3.5 the below is a JUMP_FORWARD to a JUMP_ABSOLUTE.

View File

@ -162,6 +162,7 @@ TABLE_DIRECT = {
'BINARY_SUBTRACT': ( '-' ,),
'BINARY_MULTIPLY': ( '*' ,),
'BINARY_DIVIDE': ( '/' ,),
'BINARY_MATRIX_MULTIPLY': ( '@' ,),
'BINARY_TRUE_DIVIDE': ( '/' ,),
'BINARY_FLOOR_DIVIDE': ( '//' ,),
'BINARY_MODULO': ( '%%',),
@ -174,6 +175,7 @@ TABLE_DIRECT = {
'INPLACE_ADD': ( '+=' ,),
'INPLACE_SUBTRACT': ( '-=' ,),
'INPLACE_MULTIPLY': ( '*=' ,),
'INPLACE_MATRIX_MULTIPLY': ( '@=' ,),
'INPLACE_DIVIDE': ( '/=' ,),
'INPLACE_TRUE_DIVIDE': ( '/=' ,),
'INPLACE_FLOOR_DIVIDE': ( '//=' ,),