Repository navigation
bvh_index: parse XML root past encoding headers - #3181
Conversation
672b263 to
44daebd
Compare
|
Tested 44daebd on Windows, CPython 3.14.7, CPU only (no GPU, no game files): pass.
One cosmetic edge, in case you want it: a comment between the declaration and the root ( AI-assisted. |
|
Tested 44daebd on Windows 11, Python 3.12.6, and again merged with
One thing to resolve before merging: the description and the diff don't match. The description lists a second change, if row["kind"] == "bvh4":
...
row["fill"] = {("%02x" % b): body.count(bytes([b])) for b in FILL_BYTES}( AI-assisted (Claude Code); synthetic tests only, no game files or GPU. |
|
Tested 44daebd on Windows 11, Python 3.12.10: pass
AI-assisted (Claude Code). |
Claim: #3047 (comment)
What changed
In
tools/bvh_index.py:classify(),bodywas sliced to 40 bytes (head[3:40] if head[:3] == b"\xef\xbb\xbf" else head[:40]) before scanning past?>for<RootElement>. Because<?xml version="1.0" encoding="UTF-8"?>is already 38 bytes long,<RootElement>fell past byte 40 androw["root_element"]was omitted whenever the XML declaration includedencoding.headprefix (up toHEAD = 0x140bytes) after<?xml ...?>inclassify().ClassifyTest.test_xmlintests/test_bvh_index.py.(Note: the earlier
scan_dir()chunk-fill guard from our original draft was superseded byd9bdad37onmain, so this PR is scoped strictly toclassify()'s XML root-element slice;scan_dir()'s zero-count fill keys remain untouched here.)No overlap with #2726, #3085, #3099, or #3107.
Testing
main(KeyError: 'root_element') and passes with this change.python -m compileall -q make_game.py tools tests-> exit 0python -I tests/test_bvh_index.py-> 26/26 OKpython -I tests/test_text_write_line_endings.py-> 2/2 OKAI-assisted.