Whole file
python-poetry/tomlkit
The author described this change as “Fix ParseError when a sub-table extends an array of tables out of order (#498)”. It counts as a record because the check below fails on the code as it stood at c46482be9 and passes on de68fd06e, with nothing else changed between the two runs.
Projectpython-poetry/tomlkit
Fix saved2026-06-23
Sharing licenceMIT · LICENSE
Change size+10 −0
What the code was meant to do, written into the code itself as a save note
Fix ParseError when a sub-table extends an array of tables out of order (#498)
The change
| 260 | 260 | return self | |
| 261 | 261 | elif isinstance(current, AoT): | |
| 262 | 262 | if not item.is_aot_element(): | |
| 263 | + | if item.is_super_table() and len(current.body): | |
| 264 | + | # A sub-table header such as `[fruit.apple.texture]` | |
| 265 | + | # appearing after the array `[[fruit]]` (possibly with | |
| 266 | + | # unrelated tables in between) extends the last element | |
| 267 | + | # of the array, per the TOML spec. | |
| 268 | + | last = current[-1] | |
| 269 | + | for k, v in item.value.body: | |
| 270 | + | last.value.append(k, v) | |
| 271 | + | ||
| 272 | + | return self | |
| 263 | 273 | # Tried to define a table after an AoT with the same name. | |
| 264 | 274 | raise KeyAlreadyPresent(key) | |
| 265 | 275 |
The check that tells the two apart
fail→pass·tests/test_toml_document.py::test_subtable_of_aot_element_after_other_table
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 itc46482be9b036c935a193f553c258e4e6e8e3abe
Broken version dated2026-06-23
Moduletomlkit.container
Units changedContainer
Fingerprint3d245fb040fcb648
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
- 2026-07-15Fix top-level scalar captured by a table rendered from a dotted key (#550)
- 2026-07-14Fix array of tables replacing a dotted key swallowing the next sibling (#542) (#549)
- 2026-07-14fix: avoid duplicate table header when adding a key to an out-of-order table (#545)
- 2026-06-23fix: keep newline after dotted inline table (#533)
- 2026-06-23fix: reject out-of-order concrete+super table redefinitions at parse time (#530)
- 2026-06-23raise on malformed array element instead of dropping it (#527)