From 6f3a88d7e276db57c84deb8efa446e13605e7e6f Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 5 May 2016 04:41:23 -0400 Subject: [PATCH] Fix up 3.2 tests Remove pypy --- Makefile | 2 +- test/Makefile | 4 ++++ test/bytecode_3.2/05_list_comprehension.pyc | Bin 670 -> 420 bytes uncompyle6/semantics/pysource.py | 17 +++++++++++------ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0379772d..de5bc6e3 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ check-2.7 check-3.3 check-3.4: pytest $(MAKE) -C test $@ #: Tests for Python 3.5 - pytest doesn't work here -check-3.5: +check-3.2 check-3.5: $(MAKE) -C test $@ #:Tests for Python 2.6 (doesn't have pytest) diff --git a/test/Makefile b/test/Makefile index 2ef45d6f..91343c8b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -22,6 +22,10 @@ check: #: Run working tests from Python 2.6 or 2.7 check-2.6 check-2.7: check-bytecode-sans-3.5 check-2.7-ok +#: Run working tests from Python 3.2 +check-3.2: check-bytecode + $(PYTHON) test_pythonlib.py --bytecode-3.2 --verify $(COMPILE) + #: Run working tests from Python 3.3 check-3.3: check-bytecode $(PYTHON) test_pythonlib.py --bytecode-3.3 --verify $(COMPILE) diff --git a/test/bytecode_3.2/05_list_comprehension.pyc b/test/bytecode_3.2/05_list_comprehension.pyc index 5f4b356e6f7d8c55593310e2f7ccdf4bc7f13ed9..84ba24b9873902b0f4bb9b3a1415d047381d4274 100644 GIT binary patch delta 116 zcmbQox`bIihliId_pMNPG6ND|1+pE0xL9SPyqGWtgG)0bLmo3j3L67s3Ohrv2Is_> tOFDiUEI=ihK+KTI2qKt31T&D(0C7t>fJA(JUSe))eEeiPrYMkV1^@)E5pnB>UQC^f!KImzA&;3Mg^htRg`J^=fgzQV zA%%khC<>BcOyOh**5ID#aj8C;5o!uEkOrCJ3^GL*NTf3`)G#o_Dl^nFGL$edq%eSW z#|kjiGBMOJGSo0Jh)iT=C=_ETWCI!oGA5H9NPtil@dcl#7?4*CQpL%T$pWPOG=StJMo}3JkYFhXkcf}ZOUzA;k4Kn2 N*^M!Z4J5C?1prDhDQ5rx diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 657285f7..7943e13d 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 by Rocky Bernstein +# Copyright (c) 2015, 2016 by Rocky Bernstein # Copyright (c) 2005 by Dan Pascu # Copyright (c) 2000-2002 by hartmut Goebel # Copyright (c) 1999 John Aycock @@ -1558,8 +1558,13 @@ class SourceWalker(GenericASTTraversal, object): code._tokens = None # save memory assert ast == 'stmts' - if ast[0][0] == NAME_MODULE: - if self.hide_internal: del ast[0] + try: + if ast[0][0] == NAME_MODULE: + if self.hide_internal: del ast[0] + elif ast[1][0] == NAME_MODULE: + if self.hide_internal: del ast[1] + pass + except: pass qualname = '.'.join(self.classes) @@ -1579,9 +1584,9 @@ class SourceWalker(GenericASTTraversal, object): if (ast[0][0] == ASSIGN_DOC_STRING(code.co_consts[0])): i = 0 do_doc = True - elif (len(ast) > 2 and 3.0 <= self.version <= 3.2 and - ast[2][0] == ASSIGN_DOC_STRING(code.co_consts[0])): - i = 2 + elif (len(ast) > 1 and 3.0 <= self.version <= 3.2 and + ast[1][0] == ASSIGN_DOC_STRING(code.co_consts[0])): + i = 1 do_doc = True if do_doc and self.hide_internal: self.print_docstring(indent, code.co_consts[0])