jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346044?usp=email )

Change subject: weblinkchecker: Join dead-link history report lines
......................................................................

weblinkchecker: Join dead-link history report lines

Collect the report header and history entries, then join them once.
This avoids repeatedly copying the accumulated report as a dead link's
history grows, particularly on PyPy.

Preserve entry order, archive links, timestamps and newlines. Keep the
log captions and the report sent to the talk-page queue unchanged.

Change-Id: I3e2ed093609c3a217df709d4c2f3e5b7e44d59b9
---
M scripts/weblinkchecker.py
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index b8118e6..2ecfb32 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -369,13 +369,15 @@
     def log(self, url, containing_page, archive_url) -> None:
         """Log an error report to a text file in the deadlinks subdirectory."""
         if archive_url:
-            error_report = f'* {url} ([{archive_url} archive])\n'
+            report_lines = [f'* {url} ([{archive_url} archive])\n']
         else:
-            error_report = f'* {url}\n'
+            report_lines = [f'* {url}\n']
         for (page_title, date, err) in self.history_dict[url]:
             # ISO 8601 formulation
             iso_date = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(date))
-            error_report += f'** In [[{page_title}]] on {iso_date}, {err}\n'
+            report_lines.append(
+                f'** In [[{page_title}]] on {iso_date}, {err}\n')
+        error_report = ''.join(report_lines)
         pywikibot.info('** Logging link for deletion.')
         txtfilename = pywikibot.config.datafilepath(
             'deadlinks',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1346044?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3e2ed093609c3a217df709d4c2f3e5b7e44d59b9
Gerrit-Change-Number: 1346044
Gerrit-PatchSet: 1
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to