jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] TerminalHandler: Expect str in Python 2
......................................................................
[FIX] TerminalHandler: Expect str in Python 2
The args of a record are str in Python 2 (so basically bytes). It now
compared the str with unicode which works in Python 3 (as both are the
same there) or Python 2 if the warning message contains only ASCII
characters.
With 1e54a7d6 unicode_literals was added to the module which changed the
strings into unicode in Python 2. And Python converts the string into
unicode when it tries to do a __contains__ test. It decodes it using
ASCII which fails when there are non-ASCII characters in the string.
Bug: T98955
Change-Id: Ia421c085897e14e01a59e3c2a14822b2a7cd0ddd
---
M pywikibot/userinterfaces/terminal_interface_base.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py
b/pywikibot/userinterfaces/terminal_interface_base.py
index 968a14b..c4468e3 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -491,7 +491,7 @@
msg = record.args[0]
is_useless_source_output = any(
s in msg for s in
- ('warn(', 'exceptions.', 'Warning)', 'Warning,'))
+ (str('warn('), str('exceptions.'), str('Warning)'),
str('Warning,')))
if is_useless_source_output:
record.args = ('\n'.join(record.args[0].splitlines()[0:-1]),)
--
To view, visit https://gerrit.wikimedia.org/r/210681
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia421c085897e14e01a59e3c2a14822b2a7cd0ddd
Gerrit-PatchSet: 1
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: jenkins-bot <>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits