mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1799] tools: harden isa_coverage.py BOM, SyntaxError, encoding and zero-division paths #1811
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1811
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1799
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/isa-coverage-safety📝 Commits (1)
23fad63tools: harden isa_coverage.py BOM, SyntaxError, encoding and zero-division paths📊 Changes
2 files changed (+86 additions, -6 deletions)
View changed files
📝
tests/test_isa_coverage.py(+77 -0)📝
tools/isa_coverage.py(+9 -6)📄 Description
Claimed in the coordination issue as: ISA-COVERAGE-PARSER-BOM-AND-ENCODING-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162112152)
What and why
--translatorwithencoding="utf-8-sig"inscan_translator()andaccepted_names()so files carrying a UTF-8 BOM do not failast.parse().(SyntaxError, ValueError)inmain()when parsing--translatorand report it viaap.error(...)(exit2) instead of an unhandled traceback.markdown()against empty ISA instruction tables (0instructions ->0.0%instead ofZeroDivisionError).<EncodingName>elements inread_isa()to"OTHER:?".encoding="utf-8", errors="replace"tosubprocess.run()inprobe_llvm_mc()sopython -Idoes not fail decoding tool diagnostics on ANSI code pages.tests/test_isa_coverage.py.Tested
python -I tests/test_isa_coverage.py -v->Ran 27 tests in 20.636s,OK (skipped=4)(real AMD ISA XML tests skipped without XML path; verified in a detachedupstream/mainworktree that all new tests fail before the fix:FAILED (failures=2, errors=4, skipped=4)).python -I tests/test_ci_registration.py->Ran 16 tests in 4.530s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.503s,OK.python -I scripts/check_no_game_data.py tools/isa_coverage.py tests/test_isa_coverage.py-> exit0.python -I -m compileall -q tools/isa_coverage.py tests/test_isa_coverage.pyandgit diff --check-> clean.GPUs tested: n/a (CPU/stdlib Python tests on Windows 11 x64)
AI-assisted: yes
Checklist
needs rebase).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.