diff options
author | Carl Meyer <carl@oddbird.net> | 2022-12-07 16:55:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 16:55:12 (GMT) |
commit | 68e41295b8611a990de68f15c89f1eb3dea51867 (patch) | |
tree | ea571fbecdd8cd05033707ba23da586c1cc5338f /Lib/inspect.py | |
parent | b11a384dc7471ffc16de4b86e8f5fdeef151f348 (diff) | |
download | cpython-68e41295b8611a990de68f15c89f1eb3dea51867.zip cpython-68e41295b8611a990de68f15c89f1eb3dea51867.tar.gz cpython-68e41295b8611a990de68f15c89f1eb3dea51867.tar.bz2 |
gh-83035: handle decorator with nested parens in inspect.getsource (#99654)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 31ac888..e165937 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1160,7 +1160,6 @@ class BlockFinder: self.started = False self.passline = False self.indecorator = False - self.decoratorhasargs = False self.last = 1 self.body_col0 = None @@ -1175,13 +1174,6 @@ class BlockFinder: self.islambda = True self.started = True self.passline = True # skip to the end of the line - elif token == "(": - if self.indecorator: - self.decoratorhasargs = True - elif token == ")": - if self.indecorator: - self.indecorator = False - self.decoratorhasargs = False elif type == tokenize.NEWLINE: self.passline = False # stop skipping when a NEWLINE is seen self.last = srowcol[0] @@ -1189,7 +1181,7 @@ class BlockFinder: raise EndOfBlock # hitting a NEWLINE when in a decorator without args # ends the decorator - if self.indecorator and not self.decoratorhasargs: + if self.indecorator: self.indecorator = False elif self.passline: pass |