diff options
-rw-r--r-- | plugins/python/python.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/python/python.py b/plugins/python/python.py index 371fbf40..1afb36c4 100644 --- a/plugins/python/python.py +++ b/plugins/python/python.py @@ -1,6 +1,7 @@ from __future__ import print_function import os +import pydoc import sys from contextlib import contextmanager import importlib @@ -8,6 +9,12 @@ import signal import site import traceback import weakref + +if sys.version_info < (3, 0): + from io import BytesIO as HelpEater +else: + from io import StringIO as HelpEater + from _hexchat_embedded import ffi, lib if not hasattr(sys, 'argv'): @@ -57,7 +64,6 @@ class Stdout: self.buffer += string def isatty(self): - # FIXME: help() locks app despite this? return False @@ -474,6 +480,7 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir): hexchat_stdout = Stdout() sys.stdout = hexchat_stdout sys.stderr = hexchat_stdout + pydoc.help = pydoc.Helper(HelpEater(), HelpEater()) lib.hexchat_hook_command(lib.ph, b'', 0, lib._on_say_command, ffi.NULL, ffi.NULL) lib.hexchat_hook_command(lib.ph, b'LOAD', 0, lib._on_load_command, ffi.NULL, ffi.NULL) @@ -505,6 +512,7 @@ def _on_plugin_deinit(): hexchat_stdout = None sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ + pydoc.help = pydoc.Helper() for mod in ('_hexchat', 'hexchat', 'xchat', '_hexchat_embedded'): try: |