You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Changes based on coverage information
This commit is contained in:
@@ -98,6 +98,11 @@ check-bytecode-2.4:
|
|||||||
check-bytecode-2.5:
|
check-bytecode-2.5:
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-2.5
|
$(PYTHON) test_pythonlib.py --bytecode-2.5
|
||||||
|
|
||||||
|
#: Get grammar coverage for Python 2.5
|
||||||
|
grammar-coverage-2.5:
|
||||||
|
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-25.cover $(PYTHON) test_pythonlib.py --bytecode-2.5
|
||||||
|
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-25.cover $(PYTHON) test_pyenvlib.py --2.5.6
|
||||||
|
|
||||||
#: Get grammar coverage for Python 2.6
|
#: Get grammar coverage for Python 2.6
|
||||||
grammar-coverage-2.6:
|
grammar-coverage-2.6:
|
||||||
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-26.cover $(PYTHON) test_pythonlib.py --bytecode-2.6
|
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-26.cover $(PYTHON) test_pythonlib.py --bytecode-2.6
|
||||||
|
BIN
test/bytecode_2.5/01_ops.pyc
Normal file
BIN
test/bytecode_2.5/01_ops.pyc
Normal file
Binary file not shown.
@@ -7,4 +7,7 @@ y **= 1 # INPLACE POWER
|
|||||||
y >>= 2 # INPLACE_RSHIFT
|
y >>= 2 # INPLACE_RSHIFT
|
||||||
y <<= 2 # INPLACE_LSHIFT
|
y <<= 2 # INPLACE_LSHIFT
|
||||||
y //= 1 # INPLACE_TRUE_DIVIDE
|
y //= 1 # INPLACE_TRUE_DIVIDE
|
||||||
|
y &= 1 # INPLACE_AND
|
||||||
|
y ^= 1 # INPLACE_XOR
|
||||||
|
|
||||||
`y` # UNARY_CONVERT - No in Python 3.x
|
`y` # UNARY_CONVERT - No in Python 3.x
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2016 Rocky Bernstein
|
# Copyright (c) 2016-2017 Rocky Bernstein
|
||||||
"""
|
"""
|
||||||
spark grammar differences over Python2.6 for Python 2.5.
|
spark grammar differences over Python2.6 for Python 2.5.
|
||||||
"""
|
"""
|
||||||
@@ -20,6 +20,7 @@ class Python25Parser(Python26Parser):
|
|||||||
return_if_stmt ::= ret_expr RETURN_END_IF JUMP_BACK
|
return_if_stmt ::= ret_expr RETURN_END_IF JUMP_BACK
|
||||||
|
|
||||||
# Python 2.6 uses ROT_TWO instead of the STORE_xxx
|
# Python 2.6 uses ROT_TWO instead of the STORE_xxx
|
||||||
|
# withas is allowed as a "from future" in 2.5
|
||||||
setupwithas ::= DUP_TOP LOAD_ATTR store LOAD_ATTR CALL_FUNCTION_0
|
setupwithas ::= DUP_TOP LOAD_ATTR store LOAD_ATTR CALL_FUNCTION_0
|
||||||
setup_finally
|
setup_finally
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ class Python25Parser(Python26Parser):
|
|||||||
store ::= STORE_NAME
|
store ::= STORE_NAME
|
||||||
|
|
||||||
# Python 2.6 omits ths LOAD_FAST DELETE_FAST below
|
# Python 2.6 omits ths LOAD_FAST DELETE_FAST below
|
||||||
|
# withas is allowed as a "from future" in 2.5
|
||||||
withasstmt ::= expr setupwithas designator suite_stmts_opt
|
withasstmt ::= expr setupwithas designator suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM
|
POP_BLOCK LOAD_CONST COME_FROM
|
||||||
with_cleanup
|
with_cleanup
|
||||||
|
@@ -251,8 +251,6 @@ TABLE_DIRECT = {
|
|||||||
'except_cond1': ( '%|except %c:\n', 1 ),
|
'except_cond1': ( '%|except %c:\n', 1 ),
|
||||||
'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ),
|
'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ),
|
||||||
'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ),
|
'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ),
|
||||||
'withstmt': ( '%|with %c:\n%+%c%-', 0, 3),
|
|
||||||
'withasstmt': ( '%|with %c as %c:\n%+%c%-', 0, 2, 3),
|
|
||||||
'passstmt': ( '%|pass\n', ),
|
'passstmt': ( '%|pass\n', ),
|
||||||
'STORE_FAST': ( '%{pattr}', ),
|
'STORE_FAST': ( '%{pattr}', ),
|
||||||
'kv': ( '%c: %c', 3, 1 ),
|
'kv': ( '%c: %c', 3, 1 ),
|
||||||
|
@@ -239,6 +239,9 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
TABLE_DIRECT.update({
|
TABLE_DIRECT.update({
|
||||||
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
|
'importmultiple': ( '%|import %c%c\n', 2, 3 ),
|
||||||
'import_cont' : ( ', %c', 2 ),
|
'import_cont' : ( ', %c', 2 ),
|
||||||
|
# With/as is allowed as "from future" thing
|
||||||
|
'withstmt': ( '%|with %c:\n%+%c%-', 0, 3),
|
||||||
|
'withasstmt': ( '%|with %c as %c:\n%+%c%-', 0, 2, 3),
|
||||||
})
|
})
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
Reference in New Issue
Block a user