[3.12] gh-107155: Fix help() for lambda function with return annotation (GH-115612)

(cherry picked from commit b9a9e3dd62)
This commit is contained in:
Kirill Podoprigora 2024-02-17 18:14:41 +03:00 committed by GitHub
parent 6e89292f2c
commit e32cde54f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 2 deletions

View file

@ -1131,7 +1131,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 = '(...)'
@ -1583,7 +1584,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] # remove parentheses
if not argspec:
argspec = '(...)'
decl = asyncqualifier + title + argspec + note