jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Fix for DiscussionPage.size()

If maxarchivesize is smaller than length of header no archive can be
found even the page does not exist and is empty therefore. To solve
this, DiscussionPage.size() returns 0 if the page does not exists and
has no threads.

Bug: T313886
Change-Id: Iab076d7f8caede9e3caefeb3218112358cd8bfe4
M scripts/
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/ b/scripts/
index 19ab8cf..aaad6ed 100755
--- a/scripts/
+++ b/scripts/
@@ -392,13 +392,19 @@
return self.is_full(max_archive_size)

def size(self) -> int:
- """
- Return size of talk page threads.
+ """Return size of talk page threads.

Note that this method counts bytes, rather than codepoints
(characters). This corresponds to MediaWiki's definition
of page size.
+ .. versionchanged:: 7.6
+ return 0 if archive page neither exists nor has threads
+ (:phab:`T313886`).
+ if not (self.exists() or self.threads):
+ return 0
return len(self.header.encode('utf-8')) + sum(t.size()
for t in self.threads)

To view, visit change 817716. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iab076d7f8caede9e3caefeb3218112358cd8bfe4
Gerrit-Change-Number: 817716
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <>
Gerrit-Reviewer: D3r1ck01 <>
Gerrit-Reviewer: MarcoAurelio <>
Gerrit-Reviewer: Matěj Suchánek <>
Gerrit-Reviewer: PotsdamLamb
Gerrit-Reviewer: Xqt <>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged