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})

-- 
To view, visit https://gerrit.wikimedia.org/r/190785
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I32b26e31d1d838d08d91b2c480d4800effb6995a
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to