diff --git a/test/bytecode_3.4_run/04_def_annotate.pyc b/test/bytecode_3.4_run/04_def_annotate.pyc index c91d59ce..636df9d5 100644 Binary files a/test/bytecode_3.4_run/04_def_annotate.pyc and b/test/bytecode_3.4_run/04_def_annotate.pyc differ diff --git a/test/bytecode_3.5_run/04_def_annotate.pyc b/test/bytecode_3.5_run/04_def_annotate.pyc index cea8283c..109b1a9b 100644 Binary files a/test/bytecode_3.5_run/04_def_annotate.pyc and b/test/bytecode_3.5_run/04_def_annotate.pyc differ diff --git a/test/simple_source/bug31/04_def_annotate.py b/test/simple_source/bug31/04_def_annotate.py index de80dd1a..8f3bc0f0 100644 --- a/test/simple_source/bug31/04_def_annotate.py +++ b/test/simple_source/bug31/04_def_annotate.py @@ -150,3 +150,12 @@ ann2(1) assert test12(1, 2, 3, name='hi') == (1, (2, 3)), "a, *args, name" assert test13(1, 2, 3, name='hi') == ((1, 2, 3), 'hi'), "*args, name" assert test16('localhost', loop=2, limit=3, a='b') == ('localhost', None, 2, 3, {'a': 'b'}) + +# From test 3.5 test_pydoc.py. +# Bug was in 3.5 and earlier handling of the return type, typing.Tuple[...] +try: + import typing + def foo() -> typing.Iterator[typing.Tuple[int, typing.Any]]: + ... +except: + pass diff --git a/test/stdlib/runtests.sh b/test/stdlib/runtests.sh index d2d4056c..4cd84846 100755 --- a/test/stdlib/runtests.sh +++ b/test/stdlib/runtests.sh @@ -290,7 +290,8 @@ case $PYVERSION in [test_pkgimport.py]=1 # long [test_poplib.py]=1 [test_print.py]=1 - [test_pwd.py]=1 # Takes too long + [test_pwd.py]=1 # Takes too long + [test_pydoc.py]=1 # test assertion: help text difference [test_queue.py]=1 # Possibly parameter differences - investigate [test_raise.py]=1 # Test assert error [test_range.py]=1 # doesn't terminate @@ -406,7 +407,6 @@ case $PYVERSION in [test_poll.py]=1 # Takes too long 11 seconds [test_poplib.py]=1 [test_pulldom.py]=1 - [test_pydoc.py]=1 # uncompyle6 error - Internal Error: n_build_list expects list, tuple, set, or unpack" Investigate [test_quopri.py]=1 # AssertionError: b'123=four' != '123=four' [test_range.py]=1 [test_robotparser.py]=1 diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index fab3eff4..b9980c02 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -1086,7 +1086,7 @@ class Python3Parser(PythonParser): load_op = "LOAD_CONST" if annotate_args > 0: - rule = "mkfunc_annotate ::= %s%s%sannotate_tuple load_closure %s %s %s" % ( + rule = "mkfunc_annotate ::= %s%s%sannotate_tuple load_closure %s %s" % ( "pos_arg " * args_pos, kwargs_str, "annotate_arg " * (annotate_args - 1), diff --git a/uncompyle6/semantics/make_function3.py b/uncompyle6/semantics/make_function3.py index 600681c1..3a6d6ecf 100644 --- a/uncompyle6/semantics/make_function3.py +++ b/uncompyle6/semantics/make_function3.py @@ -269,12 +269,15 @@ def make_function3_annotate( self.write("\n" + indent) line_number = self.line_number self.write(" -> ") - # value, string = annotate_args['return'] - # if string: - # self.write(' -> "%s"' % value) - # else: - # self.write(' -> %s' % value) - self.preorder(node[annotate_last - 1]) + if 'return' in annotate_dict: + self.write(annotate_dict['return']) + else: + # value, string = annotate_args['return'] + # if string: + # self.write(' -> "%s"' % value) + # else: + # self.write(' -> %s' % value) + self.preorder(node[annotate_last - 1]) self.println(":")