Skip to content

Commit

Permalink
fix: Revert "fix: Construction of OutOfOrderTableProxy can cause newl…
Browse files Browse the repository at this point in the history
…ines to be inserted (#347)" (#353)
  • Loading branch information
frostming authored May 24, 2024
1 parent 13576bb commit 30a22f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions tests/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 1 addition & 5 deletions tomlkit/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]

Expand All @@ -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:
Expand Down

0 comments on commit 30a22f7

Please sign in to comment.