Pypy 3.6 tolerance

This commit is contained in:
rocky 2019-10-28 14:46:45 -04:00
parent ebb0342b38
commit d41ef3e5dc
6 changed files with 14 additions and 3 deletions

Binary file not shown.

View File

@ -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') ),

View File

@ -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

View File

@ -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

View File

@ -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"