gh-107155: Fix help() for lambda function with return annotation (GH-107401)

This commit is contained in:
Kirill Podoprigora
2024-02-17 15:47:51 +03:00
committed by GitHub
parent 664965a1c1
commit b9a9e3dd62
3 changed files with 31 additions and 2 deletions

View File

@@ -1144,7 +1144,8 @@ class HTMLDoc(Doc):
# XXX lambda's won't usually have func_annotations['return']
# since the syntax doesn't support but it is possible.
# So removing parentheses isn't truly safe.
argspec = argspec[1:-1] # remove parentheses
if not object.__annotations__:
argspec = argspec[1:-1] # remove parentheses
if not argspec:
argspec = '(...)'
@@ -1586,7 +1587,8 @@ location listed above.
# XXX lambda's won't usually have func_annotations['return']
# since the syntax doesn't support but it is possible.
# So removing parentheses isn't truly safe.
argspec = argspec[1:-1] # remove parentheses
if not object.__annotations__:
argspec = argspec[1:-1]
if not argspec:
argspec = '(...)'
decl = asyncqualifier + title + argspec + note