diff --git a/test/bytecode_3.0_run/04_def_annotate.pyc b/test/bytecode_3.0_run/04_def_annotate.pyc index 97074d99..530e2f3b 100644 Binary files a/test/bytecode_3.0_run/04_def_annotate.pyc and b/test/bytecode_3.0_run/04_def_annotate.pyc differ diff --git a/test/bytecode_3.6_run/04_def_annotate.pyc b/test/bytecode_3.6_run/04_def_annotate.pyc index 030f4832..c1b85c14 100644 Binary files a/test/bytecode_3.6_run/04_def_annotate.pyc and b/test/bytecode_3.6_run/04_def_annotate.pyc differ diff --git a/test/bytecode_3.7_run/04_def_annotate.pyc b/test/bytecode_3.7_run/04_def_annotate.pyc index 4e165c1c..8c637402 100644 Binary files a/test/bytecode_3.7_run/04_def_annotate.pyc and b/test/bytecode_3.7_run/04_def_annotate.pyc differ diff --git a/test/bytecode_3.8_run/04_def_annotate.pyc b/test/bytecode_3.8_run/04_def_annotate.pyc index 88243654..f1c3c01c 100644 Binary files a/test/bytecode_3.8_run/04_def_annotate.pyc and b/test/bytecode_3.8_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 8f3bc0f0..250b0bf4 100644 --- a/test/simple_source/bug31/04_def_annotate.py +++ b/test/simple_source/bug31/04_def_annotate.py @@ -66,6 +66,14 @@ def div(a: dict(type=float, help='the dividend'), """Divide a by b""" return a / b +# From 3.7.6 functools.py +# Bug is in picking up the annotation. +def f(a:"This is a new annotation"): + """This is a test""" + assert f.__annotations__['a'] == "This is a new annotation" + +f(5) + class TestSignatureObject1(): def test_signature_on_wkwonly(self): def test(*, a:float, b:str, c:str = 'test', **kwargs: int) -> int: diff --git a/uncompyle6/semantics/make_function36.py b/uncompyle6/semantics/make_function36.py index c696a508..5c4da14d 100644 --- a/uncompyle6/semantics/make_function36.py +++ b/uncompyle6/semantics/make_function36.py @@ -92,7 +92,11 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None): else: pos_args, kw_args, annotate_argc, closure = args_attr - i = -4 + if node[-2] != "docstring": + i = -4 + else: + i = -5 + kw_pairs = 0 if annotate_argc: # Turn into subroutine and DRY with other use