Improve Python 1.4 bytecode coverage

This commit is contained in:
rocky
2018-06-04 08:54:09 -04:00
parent 9d3e4a6660
commit 82bc294995
16 changed files with 32 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,5 @@
# Python 1.4 aifc.py
def _readmark(self, markers):
if self._markers: print 'marker',
else: print 'markers',
print 'instead of', markers

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
"""byte compiles a Python program after version 2.2 or so. Also see compile_file_1x.py"""
import sys import sys
if len(sys.argv) != 2: if len(sys.argv) != 2:
print("Usage: compile-file.py *python-file*") print("Usage: compile-file.py *python-file*")

22
test/stdlib/compile_file_1x.py Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python
"""byte compiles a Python 1.x program"""
import sys
if len(sys.argv) != 2:
print("Usage: compile-file.py *python-file*")
sys.exit(1)
source = sys.argv[1]
# assert source.endswith('.py')
basename = source[:-3]
# We do this crazy way to support Python 1.4 which
# doesn't support version_info.
PY_VERSION = sys.version[:3]
bytecode = "%s-%s.pyc" % (basename, PY_VERSION)
import py_compile
print("# compiling %s to %s" % (source, bytecode))
py_compile.compile(source, bytecode)
# import os
# os.system("../bin/uncompyle6 %s" % bytecode)

View File

@@ -23,6 +23,8 @@ class Python14Parser(Python15Parser):
jb_pop14 jb_pop14
POP_BLOCK else_suitel COME_FROM POP_BLOCK else_suitel COME_FROM
print_items_nl_stmt ::= expr PRINT_ITEM_CONT print_items_opt PRINT_NEWLINE_CONT
""" """
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG): def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):

View File

@@ -32,5 +32,5 @@ class Scanner14(scan.Scanner15):
# # for t in tokens: # # for t in tokens:
# # print(t) # # print(t)
#
return tokens, customize # return tokens, customize