jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Support changed _vformat signature of 3.5.1
......................................................................
[FIX] Support changed _vformat signature of 3.5.1
With Python 3.5.1 the signature of `Formatter._vformat` changed. This is
supporting this change and now returns the tuple if it had returned a tuple
first.
This is not deactivating the custom `_vformat` method in Python 3 because the
patch introduced that change might be backported to Python 2.7 (see also
https://bugs.python.org/issue25034).
Bug: T121684
Change-Id: I0d1e4f062882ed03dc7bb2040984a67970df6c52
---
M pywikibot/tools/formatter.py
1 file changed, 12 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index ee34057..a571ee4 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -123,6 +123,18 @@
@rtype: unicode
"""
result = super(_ColorFormatter, self)._vformat(*args, **kwargs)
+ if isinstance(result, tuple):
+ additional_params = result[1:]
+ result = result[0]
+ else:
+ additional_params = tuple()
+ result = self._convert_bytes(result)
+ if additional_params:
+ result = (result, ) + additional_params
+ return result
+
+ def _convert_bytes(self, result):
+ """Convert everything into unicode."""
if PY2 and isinstance(result, str):
assert result == b''
result = '' # This is changing it into a unicode
--
To view, visit
https://gerrit.wikimedia.org/r/259549
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0d1e4f062882ed03dc7bb2040984a67970df6c52
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>