diff options
author | Dan Strokirk <dan.strokirk@gmail.com> | 2016-01-18 17:13:56 +0100 |
---|---|---|
committer | Dan Strokirk <dan.strokirk@gmail.com> | 2016-01-18 17:22:11 +0100 |
commit | 38435e8a053923c9e0b3e7c9a9d43dd6725c06b8 (patch) | |
tree | ad1e1710a53b73eab07dc6ed6708a03abab8c5cf /runtime/autoload/provider/script_host.py | |
parent | 9c811c6ba6e587d0e36ee331129911a39299ee42 (diff) | |
download | rneovim-38435e8a053923c9e0b3e7c9a9d43dd6725c06b8.tar.gz rneovim-38435e8a053923c9e0b3e7c9a9d43dd6725c06b8.tar.bz2 rneovim-38435e8a053923c9e0b3e7c9a9d43dd6725c06b8.zip |
python: Add missing I/O methods to RedirectStream
`RedirectStream` is used to redirect `stdout` and `stderr`, but are
missing certain I/O methods available on other file-like objects.
This causes external plugins (like `colorama`) to crash.
Inheriting from `io.IOBase` adds an abstract implementation of these
methods, which will at least keep the python code running.
Fixes #4045
Diffstat (limited to 'runtime/autoload/provider/script_host.py')
-rw-r--r-- | runtime/autoload/provider/script_host.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py index 96d70e0330..416b4070bb 100644 --- a/runtime/autoload/provider/script_host.py +++ b/runtime/autoload/provider/script_host.py @@ -1,5 +1,6 @@ """Legacy python/python3-vim emulation.""" import imp +import io import logging import os import sys @@ -151,7 +152,7 @@ class ScriptHost(object): current.range = current.buffer.range(start, stop) -class RedirectStream(object): +class RedirectStream(io.IOBase): def __init__(self, redirect_handler): self.redirect_handler = redirect_handler @@ -161,9 +162,6 @@ class RedirectStream(object): def writelines(self, seq): self.redirect_handler('\n'.join(seq)) - def flush(self): - pass - class LegacyEvalHook(neovim.SessionHook): |