Skip to content

Commit

Permalink
python: Add missing I/O methods to RedirectStream
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
strokirk committed Jan 18, 2016
1 parent 9c811c6 commit 38435e8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions runtime/autoload/provider/script_host.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Legacy python/python3-vim emulation."""
import imp
import io
import logging
import os
import sys
Expand Down Expand Up @@ -151,7 +152,7 @@ def _set_current_range(self, start, stop):
current.range = current.buffer.range(start, stop)


class RedirectStream(object):
class RedirectStream(io.IOBase):
def __init__(self, redirect_handler):
self.redirect_handler = redirect_handler

Expand All @@ -161,9 +162,6 @@ def write(self, data):
def writelines(self, seq):
self.redirect_handler('\n'.join(seq))

def flush(self):
pass


class LegacyEvalHook(neovim.SessionHook):

Expand Down

0 comments on commit 38435e8

Please sign in to comment.