diff --git a/test/bytecode_3.2/01_try_except_raise.pyc b/test/bytecode_3.2/01_try_except_raise.pyc new file mode 100644 index 00000000..879fa521 Binary files /dev/null and b/test/bytecode_3.2/01_try_except_raise.pyc differ diff --git a/test/bytecode_3.2/03_if.pyc b/test/bytecode_3.2/03_if.pyc new file mode 100644 index 00000000..5e94d59f Binary files /dev/null and b/test/bytecode_3.2/03_if.pyc differ diff --git a/test/simple_source/bug32/01_try_except_raise.py b/test/simple_source/bug32/01_try_except_raise.py new file mode 100644 index 00000000..b1cf4ee7 --- /dev/null +++ b/test/simple_source/bug32/01_try_except_raise.py @@ -0,0 +1,9 @@ +# From 3.2 _abcoll.py +def pop(self): + it = iter(self) + try: + value = next(it) + except StopIteration: + raise KeyError + self.discard(value) + return value diff --git a/test/simple_source/bug32/03_if.py b/test/simple_source/bug32/03_if.py new file mode 100644 index 00000000..cb1795f6 --- /dev/null +++ b/test/simple_source/bug32/03_if.py @@ -0,0 +1,11 @@ +# From 3.2 shlex.py +def _samefile(os, src, dst): + if hasattr(os.path, 'samefile'): + try: + return os.path.samefile(src, dst) + except OSError: + return False + + # All other platforms: check for same pathname. + return (os.path.normcase(os.path.abspath(src)) == + os.path.normcase(os.path.abspath(dst))) diff --git a/uncompyle6/parsers/parse32.py b/uncompyle6/parsers/parse32.py index 36c7338c..d3818cbc 100644 --- a/uncompyle6/parsers/parse32.py +++ b/uncompyle6/parsers/parse32.py @@ -27,6 +27,7 @@ class Python32Parser(Python3Parser): # JUMP_FORWARD in some cases, and hence we also don't # see COME_FROM _ifstmts_jump ::= c_stmts_opt + _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from stmt ::= del_deref_stmt del_deref_stmt ::= DELETE_DEREF diff --git a/uncompyle6/parsers/parse33.py b/uncompyle6/parsers/parse33.py index 9d87f7f7..c9f67712 100644 --- a/uncompyle6/parsers/parse33.py +++ b/uncompyle6/parsers/parse33.py @@ -20,7 +20,6 @@ class Python33Parser(Python32Parser): iflaststmt ::= testexpr c_stmts_opt33 c_stmts_opt33 ::= JUMP_BACK JUMP_ABSOLUTE c_stmts_opt - _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from # Python 3.5+ has jump optimization to remove the redundant # jump_excepts. But in 3.3 we need them added