Whole file

martinblech/xmltodict

The author described this change as fix(unparse): skip empty lists to keep pretty/compact outputs consistent. It counts as a record because the check below fails on the code as it stood at 220240c5e and passes on ab4c86fed, with nothing else changed between the two runs.

Fix saved2025-09-12
Sharing licenceMIT · LICENSE
Change size+2 0

What the code was meant to do, written into the code itself as a save note

fix(unparse): skip empty lists to keep pretty/compact outputs consistent

The change

494494 _validate_name(attr_name, "attribute")
495495 attrs[attr_name] = iv
496496 continue
497+ if isinstance(iv, list) and not iv:
498+ continue # Skip empty lists to avoid creating empty child elements
497499 children.append((ik, iv))
498500 if isinstance(indent, int):
499501 indent = ' ' * indent

The check that tells the two apart

failpass·tests/test_dicttoxml.py::DictToXMLTestCase::test_pretty_print_and_short_empty_elements_consistency

Check file tests/test_dicttoxml.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it220240c5eb2d12b75adf26cc84ec9c803ce8bb2b
Broken version dated2025-09-12
Modulexmltodict
Units changed_emit
Fingerprintb2bba672d32d1304
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in martinblech/xmltodict