Profiling workarounds, more coverage ...

test/Makefile: more grammar checking. Update python versions
10_del.pyc add test of DEL_GLOBAL

check_ast.py, pysource.py: Profileing workarounds
This commit is contained in:
rocky 2017-11-15 03:16:54 -05:00
parent 9a141a3144
commit 63a43d0c93
9 changed files with 24 additions and 2 deletions

View File

@ -116,6 +116,11 @@ grammar-coverage-2.7:
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-27.cover $(PYTHON) test_pythonlib.py --bytecode-2.7
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-27.cover $(PYTHON) test_pyenvlib.py --2.7.13
#: Get grammar coverage for Python 3.4
grammar-coverage-3.4:
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-34.cover $(PYTHON) test_pythonlib.py --bytecode-3.4
SPARK_PARSER_COVERAGE=/tmp/spark-grammar-34.cover $(PYTHON) test_pyenvlib.py --3.4.2
#: Check deparsing Python 2.6
check-bytecode-2.6:
$(PYTHON) test_pythonlib.py --bytecode-2.6 --weak-verify

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -11,3 +11,8 @@ del c[2:3]
d = [0,1,2,3,4,5,6]
del d[1:3:2]
e = ('a', 'b')
def foo():
global e
del e

View File

@ -30,10 +30,11 @@ from fnmatch import fnmatch
TEST_VERSIONS=('2.3.7', '2.4.6', '2.5.6', '2.6.9',
'pypy-2.4.0', 'pypy-2.6.1',
'pypy-5.0.1', 'pypy-5.3.1', 'pypy3.5-5.7.1-beta',
'2.7.10', '2.7.11', '2.7.12', '2.7.13',
'2.7.10', '2.7.11', '2.7.12', '2.7.13', '2.7.14',
'3.0.1', '3.1.5', '3.2.6',
'3.3.5', '3.3.6',
'3.4.2', '3.5.1', '3.6.0', 'native')
'3.4.2', '3.5.1', '3.5.2', '3.6.0', '3.6.3',
'native')
target_base = '/tmp/py-dis/'
lib_prefix = os.path.join(os.environ['HOME'], '.pyenv/versions')

View File

@ -263,6 +263,11 @@ class Python26Parser(Python2Parser):
if invalid:
return invalid
if rule == ('and', ('expr', 'jmp_false', 'expr', '\\e_come_from_opt')):
# FIXME: workaround profiling bug
if ast[1] is None:
return False
# Test that jmp_false jumps to the end of "and"
# or that it jumps to the same place as the end of "and"
jmp_false = ast[1][0]

View File

@ -9,6 +9,8 @@ before reduction and don't reduce when there is a problem.
"""
def checker(ast, in_loop, errors):
if ast is None:
return
in_loop = in_loop or ast.kind in ('while1stmt', 'whileTruestmt',
'whilestmt', 'whileelsestmt', 'while1elsestmt',
'for_block')

View File

@ -2239,6 +2239,10 @@ def deparse_code(version, co, out=sys.stdout, showasm=None, showast=False,
isTopLevel = co.co_name == '<module>'
deparsed.ast = deparsed.build_ast(tokens, customize, isTopLevel=isTopLevel)
#### XXX workaround for profiling
if deparsed.ast is None:
return None
assert deparsed.ast == 'stmts', 'Should have parsed grammar start'
del tokens # save memory