summaryrefslogtreecommitdiff
path: root/rplugin
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2020-03-06 21:52:29 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2020-03-06 21:52:29 +0900
commit0b7881f10d47b389c0eaa47874e64d420eefbf53 (patch)
treef4c1e82c68635018f3aae4eb3527fc6124d80809 /rplugin
parent09aa6d3c42ea3abfa635744e109b4d8ebb951d8f (diff)
downloaddeoplete.nvim-0b7881f10d47b389c0eaa47874e64d420eefbf53.zip
Fix #1077 for old msgpack compatibility
Diffstat (limited to 'rplugin')
-rw-r--r--rplugin/python3/deoplete/child.py16
-rw-r--r--rplugin/python3/deoplete/parent.py16
2 files changed, 24 insertions, 8 deletions
diff --git a/rplugin/python3/deoplete/child.py b/rplugin/python3/deoplete/child.py
index e90fb6b..c2122f9 100644
--- a/rplugin/python3/deoplete/child.py
+++ b/rplugin/python3/deoplete/child.py
@@ -39,10 +39,18 @@ class Child(logger.LoggingMixin):
self._loaded_filters: typing.Dict[str, typing.Any] = {}
self._source_errors: typing.Dict[str, int] = defaultdict(int)
self._prev_results: typing.Dict[str, Result] = {}
- self._unpacker = msgpack.Unpacker(
- unicode_errors='surrogateescape')
- self._packer = msgpack.Packer(
- unicode_errors='surrogateescape')
+ if msgpack.version < (1, 0, 0):
+ self._packer = msgpack.Packer(
+ encoding='utf-8',
+ unicode_errors='surrogateescape')
+ self._unpacker = msgpack.Unpacker(
+ encoding='utf-8',
+ unicode_errors='surrogateescape')
+ else:
+ self._unpacker = msgpack.Unpacker(
+ unicode_errors='surrogateescape')
+ self._packer = msgpack.Packer(
+ unicode_errors='surrogateescape')
self._ignore_sources: typing.List[typing.Any] = []
def main_loop(self, stdout: typing.Any) -> None:
diff --git a/rplugin/python3/deoplete/parent.py b/rplugin/python3/deoplete/parent.py
index 02e691b..3a283f8 100644
--- a/rplugin/python3/deoplete/parent.py
+++ b/rplugin/python3/deoplete/parent.py
@@ -117,10 +117,18 @@ class AsyncParent(_Parent):
self._queue_in: Queue = Queue() # type: ignore
self._queue_out: Queue = Queue() # type: ignore
self._queue_err: Queue = Queue() # type: ignore
- self._packer = msgpack.Packer(
- unicode_errors='surrogateescape')
- self._unpacker = msgpack.Unpacker(
- unicode_errors='surrogateescape')
+ if msgpack.version < (1, 0, 0):
+ self._packer = msgpack.Packer(
+ encoding='utf-8',
+ unicode_errors='surrogateescape')
+ self._unpacker = msgpack.Unpacker(
+ encoding='utf-8',
+ unicode_errors='surrogateescape')
+ else:
+ self._packer = msgpack.Packer(
+ unicode_errors='surrogateescape')
+ self._unpacker = msgpack.Unpacker(
+ unicode_errors='surrogateescape')
self._prev_pos: typing.List[typing.Any] = []
info = None