changeset 51937:936f85b243a8

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 04 Oct 2024 23:09:56 -0400
parents c6899b334d56
children fa7059f031a9
files mercurial/pure/base85.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)