mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] gh-105013: Fix inspect.getsource with parenthesized multiline lambdas (GH-105021) (#105032)
gh-105013: Fix inspect.getsource with parenthesized multiline lambdas (GH-105021)
(cherry picked from commit 3a5be878be
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
36a4227859
commit
41b622b1e8
4 changed files with 43 additions and 0 deletions
|
@ -1242,6 +1242,14 @@ def getblock(lines):
|
|||
blockfinder.tokeneater(*_token)
|
||||
except (EndOfBlock, IndentationError):
|
||||
pass
|
||||
except SyntaxError as e:
|
||||
if "unmatched" not in e.msg:
|
||||
raise e from None
|
||||
_, *_token_info = _token
|
||||
try:
|
||||
blockfinder.tokeneater(tokenize.NEWLINE, *_token_info)
|
||||
except (EndOfBlock, IndentationError):
|
||||
pass
|
||||
return lines[:blockfinder.last]
|
||||
|
||||
def getsourcelines(object):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue