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.

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

372372 return self._insert_at(last_index, key, item)
373373 else:
374374 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
375384 if not (
376385 isinstance(previous_item, Whitespace)
377386 or ends_with_whitespace(previous_item)

The check that tells the two apart

failpass·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