jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Fix format string
......................................................................
[bugfix] Fix format string
- match.groups() gives a tuple. Passing to a format string gives a
TypeError when the tuple contains more or less elements than 1.
- Use exception message directly and use str.format() method.
Bug: T152499
Change-Id: I3eef158317882f239ef3bc4bd499b31fd5bb25ce
---
M pywikibot/textlib.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Dalba: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 48ca786..9f7782e 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -403,9 +403,9 @@
replacement += new[last:group_match.start()]
replacement += match.group(group_id) or ''
except IndexError:
- pywikibot.output('\nInvalid group reference: %s' %
group_id)
- pywikibot.output('Groups found:\n%s' % match.groups())
- raise IndexError
+ raise IndexError(
+ 'Invalid group reference: {0}\nGroups found: {1}'
+ ''.format(group_id, match.groups()))
last = group_match.end()
replacement += new[last:]
--
To view, visit
https://gerrit.wikimedia.org/r/325556
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3eef158317882f239ef3bc4bd499b31fd5bb25ce
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>