Whole file

python-poetry/tomlkit

The author described this change as Fix array of tables replacing a dotted key swallowing the next sibling (#542) (#549). It counts as a record because the check below fails on the code as it stood at e23a25438 and passes on 67d3e8650, with nothing else changed between the two runs.

Fix saved2026-07-14
Sharing licenceMIT · LICENSE
Change size+7 5

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

Fix array of tables replacing a dotted key swallowing the next sibling (#542) (#549)

The change

860860 assert k is not None
861861 # A dotted key renders its value inline (e.g. ``a.b = 1``), which is only
862862 # consistent with a super table. When the replacement value renders with
863- # its own ``[header]`` instead (a non-super table), keeping the dotted key
864- # duplicates the prefix onto the header (#524). Drop the dotted key so the
865- # replacement renders as a plain table.
866- dotted_to_header = (
867- k.is_dotted() and isinstance(value, Table) and not value.is_super_table()
863+ # its own ``[header]`` instead (a non-super table, or an array of tables),
864+ # keeping the dotted key duplicates the prefix onto the header (#524) and
865+ # lets the header swallow following dotted siblings (#542). Drop the dotted
866+ # key so the replacement renders as a plain table/array of tables.
867+ dotted_to_header = k.is_dotted() and (
868+ isinstance(value, AoT)
869+ or (isinstance(value, Table) and not value.is_super_table())
868870 )
869871 # That new header also captures every sibling that renders inline -- plain
870872 # values and dotted keys -- if any still follow it (#513), so it must be

The check that tells the two apart

failpass·tests/test_toml_document.py::test_replace_dotted_key_with_aot_keeps_following_sibling

Check file tests/test_toml_document.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 ite23a25438c6cc9b8cc28b6dcf76dc52f9c7a33e3
Broken version dated2026-07-14
Moduletomlkit.container
Units changedContainer
Fingerprint94b4815e0fcd1bc9
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 python-poetry/tomlkit