jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892044 )
Change subject: [FIX] Avoid error when replacement includes backslash
......................................................................
[FIX] Avoid error when replacement includes backslash
Bug: T330021
Change-Id: I2255449aca7d496df4c56882997e254cb410d88e
---
M pywikibot/textlib.py
1 file changed, 12 insertions(+), 1 deletion(-)
Approvals:
Meno25: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 3079c22..1e09f87 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1214,7 +1214,8 @@
if re.match(fr'\s*{marker}', lastpart):
# Put the langlinks back into the noinclude's
regexp = re.compile(fr'{includeOff}\s*{marker}')
- newtext = regexp.sub(s + includeOff, s2)
+ # replace via lambda due to T330021
+ newtext = regexp.sub(lambda m: s + includeOff, s2)
else:
# Put the langlinks at the end, inside noinclude's
newtext = (s2.replace(marker, '').strip()
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/892044
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2255449aca7d496df4c56882997e254cb410d88e
Gerrit-Change-Number: 892044
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged