Skip to content

Commit a8787b3

Browse files
committed
Decode before comparing
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 3602242 commit a8787b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bpython/autocomplete.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,11 @@ def matches(self, cursor_offset, line, **kwargs):
402402
matches.add(word)
403403
for nspace in (builtins.__dict__, locals_):
404404
for word, val in iteritems(nspace):
405+
word = try_decode(word, 'ascii')
406+
# if identifier isn't ascii, don't complete (syntax error)
407+
if word is None:
408+
continue
405409
if self.method_match(word, n, text) and word != "__builtins__":
406-
word = try_decode(word, 'ascii')
407-
# if identifier isn't ascii, don't complete (syntax error)
408-
if word is None:
409-
continue
410410
matches.add(_callable_postfix(val, word))
411411
return matches
412412

0 commit comments

Comments
 (0)