01-fix-readline.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --- contrib/deprecated/python/win-unicode-console/win_unicode_console/__init__.py (index)
  2. +++ contrib/deprecated/python/win-unicode-console/win_unicode_console/__init__.py (working tree)
  3. @@ -1,5 +1,5 @@
  4. -from . import streams, console, readline_hook
  5. +from . import streams, console #, readline_hook
  6. from .info import WINDOWS, PY2
  7. if PY2:
  8. @@ -14,7 +14,7 @@ def enable(
  9. stdin = Ellipsis,
  10. stdout = Ellipsis,
  11. stderr = Ellipsis,
  12. - use_readline_hook = True,
  13. + use_readline_hook = False,
  14. use_pyreadline = True,
  15. use_raw_input = True, # PY2
  16. raw_input__return_unicode = raw_input.RETURN_UNICODE if PY2 else None,
  17. @@ -27,8 +27,8 @@ def enable(
  18. streams.enable(stdin=stdin, stdout=stdout, stderr=stderr)
  19. - if use_readline_hook:
  20. - readline_hook.enable(use_pyreadline=use_pyreadline)
  21. + #if use_readline_hook:
  22. + # readline_hook.enable(use_pyreadline=use_pyreadline)
  23. if PY2 and use_raw_input:
  24. raw_input.enable(raw_input__return_unicode)
  25. @@ -50,5 +50,5 @@ def disable():
  26. unicode_argv.disable()
  27. raw_input.disable()
  28. - readline_hook.disable()
  29. + #readline_hook.disable()
  30. streams.disable()
  31. --- contrib/deprecated/python/win-unicode-console/win_unicode_console/readline_hook.py (index)
  32. +++ contrib/deprecated/python/win-unicode-console/win_unicode_console/readline_hook.py (working tree)
  33. @@ -38,7 +38,7 @@ strncpy.argtypes = [c_char_p, c_char_p, c_size_t]
  34. HOOKFUNC = CFUNCTYPE(c_char_p, c_void_p, c_void_p, c_char_p)
  35. -PyOS_ReadlineFunctionPointer = c_void_p.in_dll(pythonapi, "PyOS_ReadlineFunctionPointer")
  36. +#PyOS_ReadlineFunctionPointer = c_void_p.in_dll(pythonapi, "PyOS_ReadlineFunctionPointer")
  37. def new_zero_terminated_string(b):
  38. @@ -63,7 +63,7 @@ class ReadlineHookManager:
  39. def __init__(self):
  40. self.readline_wrapper_ref = HOOKFUNC(self.readline_wrapper)
  41. self.address = cast(self.readline_wrapper_ref, c_void_p).value
  42. - self.original_address = PyOS_ReadlineFunctionPointer.value
  43. + #self.original_address = PyOS_ReadlineFunctionPointer.value
  44. self.readline_hook = None
  45. def readline_wrapper(self, stdin, stdout, prompt):