jenkins-bot submitted this change.
[cleanup] no longer use win32_unicode for Python 3.6+
The issue is solved in Python 3.6+
https://bugs.python.org/issue1602
Change-Id: Id507c11040e186ebc0c26173a8dc03fca89547a9
---
M pywikibot/userinterfaces/terminal_interface_win32.py
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/pywikibot/userinterfaces/terminal_interface_win32.py b/pywikibot/userinterfaces/terminal_interface_win32.py
index 05b62eb..9db1fac 100755
--- a/pywikibot/userinterfaces/terminal_interface_win32.py
+++ b/pywikibot/userinterfaces/terminal_interface_win32.py
@@ -1,12 +1,13 @@
"""User interface for Win32 terminals."""
#
-# (C) Pywikibot team, 2003-2020
+# (C) Pywikibot team, 2003-2022
#
# Distributed under the terms of the MIT license.
#
import ctypes
-from pywikibot.userinterfaces import terminal_interface_base, win32_unicode
+from pywikibot.tools import PYTHON_VERSION
+from pywikibot.userinterfaces import terminal_interface_base
windowsColors = {
@@ -37,12 +38,14 @@
def __init__(self):
"""Initializer."""
super().__init__()
- (stdin, stdout, stderr, argv) = win32_unicode.get_unicode_console()
- self.stdin = stdin
- self.stdout = stdout
- self.stderr = stderr
- self.argv = argv
- self.encoding = 'utf-8'
+ if PYTHON_VERSION == (3, 5): # issue1602 solved in Python 3.6
+ from pywikibot.userinterfaces import win32_unicode
+ stdin, stdout, stderr, argv = win32_unicode.get_unicode_console()
+ self.stdin = stdin
+ self.stdout = stdout
+ self.stderr = stderr
+ self.argv = argv
+ self.encoding = 'utf-8'
def support_color(self, target_stream):
"""Return whether the target stream supports actually color."""
To view, visit change 766779. To unsubscribe, or for help writing mail filters, visit settings.