diff --git a/test/bytecode_1.4/01_print-1.4.pyc b/test/bytecode_1.4/01_print-1.4.pyc new file mode 100644 index 00000000..90be8c44 Binary files /dev/null and b/test/bytecode_1.4/01_print-1.4.pyc differ diff --git a/test/bytecode_1.4/test_class-1.4.pyc b/test/bytecode_1.4/test_class.pyc similarity index 100% rename from test/bytecode_1.4/test_class-1.4.pyc rename to test/bytecode_1.4/test_class.pyc diff --git a/test/bytecode_1.4/test_del-1.4.pyc b/test/bytecode_1.4/test_del-1.4.pyc deleted file mode 100644 index f6c02ff6..00000000 Binary files a/test/bytecode_1.4/test_del-1.4.pyc and /dev/null differ diff --git a/test/bytecode_1.4/test_docstring-1.4.pyc b/test/bytecode_1.4/test_docstring.pyc similarity index 100% rename from test/bytecode_1.4/test_docstring-1.4.pyc rename to test/bytecode_1.4/test_docstring.pyc diff --git a/test/bytecode_1.4/test_empty-1.4.pyc b/test/bytecode_1.4/test_empty-1.4.pyc deleted file mode 100644 index 8c8d8b48..00000000 Binary files a/test/bytecode_1.4/test_empty-1.4.pyc and /dev/null differ diff --git a/test/bytecode_1.4/test_empty.pyc b/test/bytecode_1.4/test_empty.pyc new file mode 100644 index 00000000..dfbc477c Binary files /dev/null and b/test/bytecode_1.4/test_empty.pyc differ diff --git a/test/bytecode_1.4/test_exec.pyc b/test/bytecode_1.4/test_exec.pyc new file mode 100644 index 00000000..ef47f862 Binary files /dev/null and b/test/bytecode_1.4/test_exec.pyc differ diff --git a/test/bytecode_1.4/test_global-1.4.pyc b/test/bytecode_1.4/test_global.pyc similarity index 100% rename from test/bytecode_1.4/test_global-1.4.pyc rename to test/bytecode_1.4/test_global.pyc diff --git a/test/bytecode_1.4/test_globals-1.4.pyc b/test/bytecode_1.4/test_globals.pyc similarity index 100% rename from test/bytecode_1.4/test_globals-1.4.pyc rename to test/bytecode_1.4/test_globals.pyc diff --git a/test/bytecode_1.4/test_single_stmt-1.4.pyc b/test/bytecode_1.4/test_single_stmt.pyc similarity index 100% rename from test/bytecode_1.4/test_single_stmt-1.4.pyc rename to test/bytecode_1.4/test_single_stmt.pyc diff --git a/test/bytecode_1.5/exec.pyc b/test/bytecode_1.5/exec.pyc deleted file mode 100644 index d1a50e6b..00000000 Binary files a/test/bytecode_1.5/exec.pyc and /dev/null differ diff --git a/test/simple_source/bug14/01_print.py b/test/simple_source/bug14/01_print.py new file mode 100644 index 00000000..dae12a98 --- /dev/null +++ b/test/simple_source/bug14/01_print.py @@ -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 diff --git a/test/stdlib/compile-file.py b/test/stdlib/compile-file.py index 93b37688..cfbb9c5c 100755 --- a/test/stdlib/compile-file.py +++ b/test/stdlib/compile-file.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +"""byte compiles a Python program after version 2.2 or so. Also see compile_file_1x.py""" import sys if len(sys.argv) != 2: print("Usage: compile-file.py *python-file*") diff --git a/test/stdlib/compile_file_1x.py b/test/stdlib/compile_file_1x.py new file mode 100755 index 00000000..3017b280 --- /dev/null +++ b/test/stdlib/compile_file_1x.py @@ -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) diff --git a/uncompyle6/parsers/parse14.py b/uncompyle6/parsers/parse14.py index d1c3fc62..10f74ff1 100644 --- a/uncompyle6/parsers/parse14.py +++ b/uncompyle6/parsers/parse14.py @@ -23,6 +23,8 @@ class Python14Parser(Python15Parser): jb_pop14 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): diff --git a/uncompyle6/scanners/scanner14.py b/uncompyle6/scanners/scanner14.py index 89db85f7..5e80cf4a 100644 --- a/uncompyle6/scanners/scanner14.py +++ b/uncompyle6/scanners/scanner14.py @@ -32,5 +32,5 @@ class Scanner14(scan.Scanner15): # # for t in tokens: # # print(t) - - return tokens, customize + # + # return tokens, customize