diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 13:38:37 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-07-01 14:17:44 +0200 |
commit | 7ee9de59fd31c3fdbe7e820406db4e5fb7cd3350 (patch) | |
tree | 475b6d027975bab40263e0704d195629f094b40a /pylint/checkers/similar.py | |
parent | 21290866a2da5ac25a888624bec2ba350e521e98 (diff) | |
download | pylint-git-7ee9de59fd31c3fdbe7e820406db4e5fb7cd3350.tar.gz |
[duplicate-code] Fix crash when analysing empty function with docstring
Closes #4648
Diffstat (limited to 'pylint/checkers/similar.py')
-rw-r--r-- | pylint/checkers/similar.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 967796b2b..5f421f054 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -218,7 +218,13 @@ def stripped_lines( if isinstance(n, (astroid.FunctionDef, astroid.AsyncFunctionDef)) ] signature_lines = set( - chain(*(range(func.fromlineno, func.body[0].lineno) for func in functions)) + chain( + *( + range(func.fromlineno, func.body[0].lineno) + for func in functions + if func.body + ) + ) ) strippedlines = [] |