diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d04cc7..833c2dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ ### Fixed - Fix the incompatiblity with 3.13 because of the `datetime.replace()` change. ([#333](https://github.com/python-poetry/tomlkit/issues/333)) +- Revert the change of parsing out-of-order tables. ([#347](https://github.com/python-poetry/tomlkit/issues/347)) -## [0.12.4] - 2024-05-08 +## [0.12.5] - 2024-05-08 ### Fixed diff --git a/tests/test_items.py b/tests/test_items.py index 3d2de68..8d6723e 100644 --- a/tests/test_items.py +++ b/tests/test_items.py @@ -985,14 +985,3 @@ def test_no_extra_minus_sign(): assert doc.as_string() == "a = +1.5" doc["a"] *= -1 assert doc.as_string() == "a = -1.5" - - -def test_no_newline_after_visit_oo_table(): - content = """\ -[a.b.c.d] -[unrelated] -[a.b.e] -""" - doc = parse(content) - doc["a"] - assert doc.as_string() == content diff --git a/tomlkit/container.py b/tomlkit/container.py index 06e6483..e14112f 100644 --- a/tomlkit/container.py +++ b/tomlkit/container.py @@ -323,8 +323,6 @@ def _raw_append(self, key: Key | None, item: Item) -> None: if key is not None: dict.__setitem__(self, key.key, item.value) - return self - def _remove_at(self, idx: int) -> None: key = self._body[idx][0] index = self._map.get(key) @@ -794,8 +792,6 @@ def __init__(self, container: Container, indices: tuple[int]) -> None: self._tables = [] self._tables_map = {} - original_parsing = container._parsed - container.parsing(True) for i in indices: _, item = self._container._body[i] @@ -807,7 +803,7 @@ def __init__(self, container: Container, indices: tuple[int]) -> None: self._tables_map[k] = table_idx if k is not None: dict.__setitem__(self, k.key, v) - container.parsing(original_parsing) + self._internal_container._validate_out_of_order_table() def unwrap(self) -> str: