Skip to content

Commit 17ca924

Browse files
committed
Python 3 host: Handle byte strings for specs requests. #121
1 parent 7f5b1d0 commit 17ca924

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

neovim/plugin/host.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, nvim):
3333
self._notification_handlers = {}
3434
self._request_handlers = {
3535
'poll': lambda: 'ok',
36-
'specs': lambda path: self._specs.get(path, []),
36+
'specs': self._on_specs_request,
3737
'shutdown': self.shutdown
3838
}
3939
self._nvim_encoding = nvim.options['encoding']
@@ -156,6 +156,11 @@ def predicate(o):
156156
if specs:
157157
self._specs[plugin_path] = specs
158158

159+
def _on_specs_request(self, path):
160+
if IS_PYTHON3 and isinstance(path, bytes):
161+
path = path.decode(self._nvim_encoding)
162+
return self._specs.get(path, [])
163+
159164
def _configure_nvim_for(self, obj):
160165
# Configure a nvim instance for obj(checks encoding configuration)
161166
nvim = self.nvim

0 commit comments

Comments
 (0)