Skip to content

Commit 80def3f

Browse files
committed
check for None value
1 parent a712a73 commit 80def3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyls/plugins/importmagic_lint.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def _tokenize(source):
6868
"""Tokenize python source code.
6969
"""
7070
stream = BytesIO(source.encode())
71-
return list(tokenize.tokenize(stream.readline))
71+
tokens = tokenize.tokenize(stream.readline)
72+
if tokens is None:
73+
return []
74+
return list(tokens)
7275

7376

7477
def _search_symbol(source, symbol):

0 commit comments

Comments
 (0)