Skip to content

Commit 643a091

Browse files
committed
Return None on error instead of asserting
1 parent 0746e55 commit 643a091

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bpython/autocomplete.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,11 @@ def matches(
480480
r = self.locate(cursor_offset, line)
481481
if r is None:
482482
return None
483-
curDictParts = lineparts.current_dict(cursor_offset, line)
484-
assert curDictParts, "current_dict when .locate() truthy"
485-
_, _, dexpr = curDictParts
483+
current_dict_parts = lineparts.current_dict(cursor_offset, line)
484+
if current_dict_parts is None:
485+
return None
486+
487+
_, _, dexpr = current_dict_parts
486488
try:
487489
obj = safe_eval(dexpr, locals_)
488490
except EvaluationError:

0 commit comments

Comments
 (0)