mirror of
https://github.com/python/cpython.git
synced 2025-08-06 09:59:07 +00:00
[3.12] gh-107155: Fix help() for lambda function with return annotation (GH-115612)
(cherry picked from commit b9a9e3dd62
)
This commit is contained in:
parent
6e89292f2c
commit
e32cde54f5
3 changed files with 31 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue