jenkins-bot submitted this change.
[FIX] Avoid error when replacement includes backslash
Bug: T330021
Change-Id: I2255449aca7d496df4c56882997e254cb410d88e
---
M pywikibot/textlib.py
1 file changed, 12 insertions(+), 1 deletion(-)
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 change 892044. To unsubscribe, or for help writing mail filters, visit settings.