You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Pypy 3.6 tolerance
This commit is contained in:
BIN
test/bytecode_pypy3.6/00_import.pyc
Normal file
BIN
test/bytecode_pypy3.6/00_import.pyc
Normal file
Binary file not shown.
@@ -29,6 +29,9 @@ def customize_for_version(self, is_pypy, version):
|
|||||||
#######################
|
#######################
|
||||||
TABLE_DIRECT.update({
|
TABLE_DIRECT.update({
|
||||||
'assert_pypy': ( '%|assert %c\n' , (1, 'assert_expr') ),
|
'assert_pypy': ( '%|assert %c\n' , (1, 'assert_expr') ),
|
||||||
|
# This is as a result of an if transoration
|
||||||
|
'assert0_pypy': ( '%|assert %c\n' , (0, 'assert_expr') ),
|
||||||
|
|
||||||
'assert_not_pypy': ( '%|assert not %c\n' , (1, 'assert_exp') ),
|
'assert_not_pypy': ( '%|assert not %c\n' , (1, 'assert_exp') ),
|
||||||
'assert2_not_pypy': ( '%|assert not %c, %c\n' , (1, 'assert_exp'),
|
'assert2_not_pypy': ( '%|assert not %c, %c\n' , (1, 'assert_exp'),
|
||||||
(4, 'expr') ),
|
(4, 'expr') ),
|
||||||
|
@@ -187,6 +187,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
|||||||
self.hide_internal = False
|
self.hide_internal = False
|
||||||
self.offsets = {}
|
self.offsets = {}
|
||||||
self.last_finish = -1
|
self.last_finish = -1
|
||||||
|
self.is_pypy = is_pypy
|
||||||
|
|
||||||
# FIXME: is there a better way?
|
# FIXME: is there a better way?
|
||||||
global MAP_DIRECT_FRAGMENT
|
global MAP_DIRECT_FRAGMENT
|
||||||
|
@@ -239,7 +239,9 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
is_pypy=is_pypy,
|
is_pypy=is_pypy,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.treeTransform = TreeTransform(version, showast)
|
self.treeTransform = TreeTransform(version=version,
|
||||||
|
show_ast=showast,
|
||||||
|
is_pypy=is_pypy)
|
||||||
self.debug_parser = dict(debug_parser)
|
self.debug_parser = dict(debug_parser)
|
||||||
self.showast = showast
|
self.showast = showast
|
||||||
self.params = params
|
self.params = params
|
||||||
|
@@ -30,9 +30,11 @@ def is_docstring(node):
|
|||||||
|
|
||||||
|
|
||||||
class TreeTransform(GenericASTTraversal, object):
|
class TreeTransform(GenericASTTraversal, object):
|
||||||
def __init__(self, version, show_ast=None):
|
def __init__(self, version, show_ast=None,
|
||||||
|
is_pypy=False):
|
||||||
self.version = version
|
self.version = version
|
||||||
self.showast = show_ast
|
self.showast = show_ast
|
||||||
|
self.is_pypy = is_pypy
|
||||||
return
|
return
|
||||||
|
|
||||||
def maybe_show_tree(self, ast):
|
def maybe_show_tree(self, ast):
|
||||||
@@ -133,7 +135,10 @@ class TreeTransform(GenericASTTraversal, object):
|
|||||||
# becomes:
|
# becomes:
|
||||||
# assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 COME_FROM
|
# assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 COME_FROM
|
||||||
if jump_cond == "jmp_true":
|
if jump_cond == "jmp_true":
|
||||||
kind = "assert"
|
if self.is_pypy:
|
||||||
|
kind = "assert0_pypy"
|
||||||
|
else:
|
||||||
|
kind = "assert"
|
||||||
else:
|
else:
|
||||||
assert jump_cond == "jmp_false"
|
assert jump_cond == "jmp_false"
|
||||||
kind = "assertnot"
|
kind = "assertnot"
|
||||||
|
Reference in New Issue
Block a user