contrib/locale/push_locale: trivial follow-up: write vs writelines
What changed, and why it matters
This is a tiny code cleanup in an internal Electrum translation helper script. The developer replaced `writelines` with `write` when saving a list of filenames to a text file. Both versions produced the same output, so this change has no security relevance.
No action needed. This commit is a benign cleanup with no security implications.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In contrib/locale/push_locale.py, the loop was calling f.writelines(item + "\n") for each individual string. writelines expects an iterable of lines, but passing a single string works because Python iterates the string into characters, and each character is written as its own ‘line’ (with no added newlines by writelines). Since the string already ends with \n, the final file content is identical. The patch switches to f.write(item + "\n"), which is semantically correct but functionally equivalent. This is a non-security, developer-experience follow-up.
Changed components
contrib/locale/push_locale.pyInspect captured patch +1 / −1
diff --git a/contrib/locale/push_locale.py b/contrib/locale/push_locale.py
index da7e84f..bd4c847 100755
--- a/contrib/locale/push_locale.py
+++ b/contrib/locale/push_locale.py
@@ -55,7 +55,7 @@ files_list = glob.glob("electrum/**/*.py", recursive=True)
files_list = sorted(files_list) # makes output deterministic across CI runs
with open(f"{build_dir}/app.fil", "w", encoding="utf-8") as f:
for item in files_list:
- f.writelines(item + "\n")
+ f.write(item + "\n")
print("Found {} .py files to translate".format(len(files_list)))
# Generate fresh translation template
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.