# HG changeset patch # User Matt Harbison # Date 1728097796 14400 # Node ID 936f85b243a88f7981a26ae516617b0d5a488618 # Parent c6899b334d5601994fe9fc3b2a4af01aed768707 base85: avoid a spurious use-before-initialized warning in `pure` module The error wasn't possible because the only way for `acc` to not be initialized was if `len(text) == 0`. But then `0 % 5 == 0`, so no attempt at padding was done. It's a simple enough fix to not have PyCharm flag this though. The value needs to be reset on each loop iteration, so it's a line copy, not a line move. diff -r c6899b334d56 -r 936f85b243a8 mercurial/pure/base85.py --- a/mercurial/pure/base85.py Mon Sep 30 19:40:14 2024 -0400 +++ b/mercurial/pure/base85.py Fri Oct 04 23:09:56 2024 -0400 @@ -58,6 +58,8 @@ l = len(text) out = [] + acc = 0 + for i in range(0, len(text), 5): chunk = text[i : i + 5] chunk = pycompat.bytestr(chunk)