-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to delete an item of OutOfOrderTableProxy #383
Comments
I think this may be the same bug: import tomlkit
del tomlkit.loads("[tool.pdm.scripts]\n[tool.pdm]\n[dependency-groups]\n[tool.ruff]\n")["tool"]["pdm"]' Outputs:
Deleting other keys works fine. I traced the problem to here, in def __init__(self, container: Container, indices: tuple[int, ...]) -> None:
self._container = container
self._internal_container = Container(True)
self._tables = []
self._tables_map = {}
for i in indices:
_, item = self._container._body[i]
if isinstance(item, Table):
self._tables.append(item)
table_idx = len(self._tables) - 1
for k, v in item.value.body:
self._internal_container._raw_append(k, v)
self._tables_map.setdefault(k, []).append(table_idx)
if k is not None:
dict.__setitem__(self, k.key, v) In this case,
So we go around the I made a small change to
And it appears to work, for this case and a few other simple sanity checks:
|
Hello, first of all, thanks for creating a great library.
I noticed there is a glitch while dealing with
OutOfOrderTableProxy
. I cannot delete a key viapop
.(Tested with v0.13.2)
Am I misusing something? Or is this a bug in
OutOfOrderTableProxy
's__delitem__
method?The text was updated successfully, but these errors were encountered: