mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-02-17 03:38:13 +00:00
Pypy 3.6 tolerance
This commit is contained in:
parent
ebb0342b38
commit
d41ef3e5dc
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({
|
||||
'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') ),
|
||||
'assert2_not_pypy': ( '%|assert not %c, %c\n' , (1, 'assert_exp'),
|
||||
(4, 'expr') ),
|
||||
|
@ -187,6 +187,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
self.hide_internal = False
|
||||
self.offsets = {}
|
||||
self.last_finish = -1
|
||||
self.is_pypy = is_pypy
|
||||
|
||||
# FIXME: is there a better way?
|
||||
global MAP_DIRECT_FRAGMENT
|
||||
|
@ -239,7 +239,9 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
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.showast = showast
|
||||
self.params = params
|
||||
|
@ -30,9 +30,11 @@ def is_docstring(node):
|
||||
|
||||
|
||||
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.showast = show_ast
|
||||
self.is_pypy = is_pypy
|
||||
return
|
||||
|
||||
def maybe_show_tree(self, ast):
|
||||
@ -133,7 +135,10 @@ class TreeTransform(GenericASTTraversal, object):
|
||||
# becomes:
|
||||
# assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 COME_FROM
|
||||
if jump_cond == "jmp_true":
|
||||
kind = "assert"
|
||||
if self.is_pypy:
|
||||
kind = "assert0_pypy"
|
||||
else:
|
||||
kind = "assert"
|
||||
else:
|
||||
assert jump_cond == "jmp_false"
|
||||
kind = "assertnot"
|
||||
|
Loading…
x
Reference in New Issue
Block a user