You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Bug in finding annotation in fn with docstring
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -66,6 +66,14 @@ def div(a: dict(type=float, help='the dividend'),
|
|||||||
"""Divide a by b"""
|
"""Divide a by b"""
|
||||||
return a / 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():
|
class TestSignatureObject1():
|
||||||
def test_signature_on_wkwonly(self):
|
def test_signature_on_wkwonly(self):
|
||||||
def test(*, a:float, b:str, c:str = 'test', **kwargs: int) -> int:
|
def test(*, a:float, b:str, c:str = 'test', **kwargs: int) -> int:
|
||||||
|
@@ -92,7 +92,11 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
else:
|
else:
|
||||||
pos_args, kw_args, annotate_argc, closure = args_attr
|
pos_args, kw_args, annotate_argc, closure = args_attr
|
||||||
|
|
||||||
i = -4
|
if node[-2] != "docstring":
|
||||||
|
i = -4
|
||||||
|
else:
|
||||||
|
i = -5
|
||||||
|
|
||||||
kw_pairs = 0
|
kw_pairs = 0
|
||||||
if annotate_argc:
|
if annotate_argc:
|
||||||
# Turn into subroutine and DRY with other use
|
# Turn into subroutine and DRY with other use
|
||||||
|
Reference in New Issue
Block a user