Skip to content

Commit ed02600

Browse files
committed
Handle empty files / strings as well
Signed-off-by: mshafer-NI <[email protected]>
1 parent d7d9584 commit ed02600

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pycodestyle.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,11 @@ def is_string_literal(line):
11961196

11971197
def _use_ast_to_check_for_lambda_assignment(logical_line):
11981198
"""Check if the line contains a lambda assignment."""
1199+
if not logical_line:
1200+
return False
11991201
try:
12001202
tree = ast.parse(logical_line)
1201-
except SyntaxError:
1203+
except (SyntaxError, ValueError):
12021204
return False
12031205
for node in ast.walk(tree):
12041206
if isinstance(node, ast.Assign):

0 commit comments

Comments
 (0)