Fix bug in handling 3.5- complex annotation return...

Go over runtests.sh for 3.5
This commit is contained in:
rocky
2020-01-09 19:55:22 -05:00
parent fee02e0aa0
commit 8b74d8f855
6 changed files with 21 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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),

View File

@@ -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(":")