jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Config2: Don't decode user-config ......................................................................
[FIX] Config2: Don't decode user-config
It doesn't try to decode the user-config.py by itself but let compile() handle a byte string. That does interpret the header in the file and decode it accordingly.
Change-Id: I32b26e31d1d838d08d91b2c480d4800effb6995a --- M pywikibot/config2.py 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: XZise: Looks good to me, but someone else must approve Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py index fb68ec1..0d9d670 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -830,7 +830,8 @@ _fileuid = _filestatus[4] if sys.platform == 'win32' or _fileuid in [os.getuid(), 0]: if sys.platform == 'win32' or _filemode & 0o02 == 0: - exec(compile(open(_filename).read(), _filename, 'exec'), _uc) + with open(_filename, 'rb') as f: + exec(compile(f.read(), _filename, 'exec'), _uc) else: print("WARNING: Skipped '%(fn)s': writeable by others." % {'fn': _filename})
pywikibot-commits@lists.wikimedia.org