jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IO] remove outdated register_cp65001() function

cp65001 is an alias for utf-8 since Python 3.8
and was added to the codecs table in Python 3.3 already

https://docs.python.org/3/library/codecs.html
https://docs.python.org/3.7/library/codecs.html

Change-Id: I35277ca3d4a018cc4673c5ac84a8e89e4026cfd0
---
M pywikibot/userinterfaces/win32_unicode.py
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 7962408..4b858de 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -1,6 +1,6 @@
"""Stdout, stderr and argv support for unicode."""
#
-# (C) Pywikibot team, 2012-2018
+# (C) Pywikibot team, 2012-2021
#
##############################################
# Support for unicode in Windows cmd.exe
@@ -21,8 +21,8 @@
# Licensed under both CC-BY-SA and the MIT license.
#
################################################
-import codecs
import sys
+
from contextlib import suppress
from ctypes import Structure, byref
from ctypes import c_void_p as LPVOID
@@ -172,13 +172,6 @@
file=original_stderr)


-def register_cp65001():
- """Register codecs cp65001 as utf-8."""
- # Work around <https://bugs.python.org/issue6058>
- codecs.register(lambda name: name == 'cp65001'
- and codecs.lookup('utf-8') or None)
-
-
def force_truetype_console(h_stdout):
"""Force the console to use a TrueType font (Vista+)."""
TMPF_TRUETYPE = 0x04
@@ -331,7 +324,3 @@
.format(e))

return stdin, stdout, stderr, argv
-
-
-if OSWIN32:
- register_cp65001()

To view, visit change 687203. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I35277ca3d4a018cc4673c5ac84a8e89e4026cfd0
Gerrit-Change-Number: 687203
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged