Whole file
python-poetry/tomlkit
The author described this change as “fix: keep newline after dotted inline table (#533)”. It counts as a record because the check below fails on the code as it stood at d3c76f0bb and passes on 43668ddeb, with nothing else changed between the two runs.
Projectpython-poetry/tomlkit
Fix saved2026-06-23
Sharing licenceMIT · LICENSE
Change size+9 −0
What the code was meant to do, written into the code itself as a save note
fix: keep newline after dotted inline table (#533)
The change
| 372 | 372 | return self._insert_at(last_index, key, item) | |
| 373 | 373 | else: | |
| 374 | 374 | previous_item = self._body[-1][1] | |
| 375 | + | if isinstance(previous_item, Table) and previous_item.is_super_table(): | |
| 376 | + | previous_child = previous_item.value._previous_item() | |
| 377 | + | if ( | |
| 378 | + | previous_child is not None | |
| 379 | + | and not isinstance(previous_child, Whitespace) | |
| 380 | + | and "\n" in previous_item.trivia.trail | |
| 381 | + | and "\n" not in previous_child.trivia.trail | |
| 382 | + | ): | |
| 383 | + | previous_child.trivia.trail += previous_item.trivia.trail | |
| 375 | 384 | if not ( | |
| 376 | 385 | isinstance(previous_item, Whitespace) | |
| 377 | 386 | or ends_with_whitespace(previous_item) |
The check that tells the two apart
fail→pass·tests/test_toml_document.py::test_add_key_after_dotted_inline_table_without_ending_newline
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 itd3c76f0bbe90af4b12a3b83bd8e59bc9061dfe85
Broken version dated2026-06-23
Moduletomlkit.container
Units changedContainer
Fingerprint338f73f009fe1694
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: reject out-of-order concrete+super table redefinitions at parse time (#530)
- 2026-06-23raise on malformed array element instead of dropping it (#527)
- 2026-06-23Fix ParseError when a sub-table extends an array of tables out of order (#498)