mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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
This commit is contained in:
parent
9c811c6ba6
commit
38435e8a05
@ -1,5 +1,6 @@
|
|||||||
"""Legacy python/python3-vim emulation."""
|
"""Legacy python/python3-vim emulation."""
|
||||||
import imp
|
import imp
|
||||||
|
import io
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -151,7 +152,7 @@ class ScriptHost(object):
|
|||||||
current.range = current.buffer.range(start, stop)
|
current.range = current.buffer.range(start, stop)
|
||||||
|
|
||||||
|
|
||||||
class RedirectStream(object):
|
class RedirectStream(io.IOBase):
|
||||||
def __init__(self, redirect_handler):
|
def __init__(self, redirect_handler):
|
||||||
self.redirect_handler = redirect_handler
|
self.redirect_handler = redirect_handler
|
||||||
|
|
||||||
@ -161,9 +162,6 @@ class RedirectStream(object):
|
|||||||
def writelines(self, seq):
|
def writelines(self, seq):
|
||||||
self.redirect_handler('\n'.join(seq))
|
self.redirect_handler('\n'.join(seq))
|
||||||
|
|
||||||
def flush(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class LegacyEvalHook(neovim.SessionHook):
|
class LegacyEvalHook(neovim.SessionHook):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user