You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KeyAlreadyPresent when accessing valid TOML with repeated array tables under an out-of-order table #505
If tomlkit.parse() accepts the TOML document, then accessing doc.get("hooks") should not fail with KeyAlreadyPresent.
Repeated array tables like this are valid TOML:
[hooks]
[[hooks.Stop]]
matcher = ".*"
[[hooks.Stop.hooks]]
type = "command"command = "one"# even some actual content in here is valid but tomlkit gives an issue if something else is present
[[hooks.Stop]]
matcher = ".*"
[[hooks.Stop.hooks]]
type = "command"command = "two"
[hooks.state]
[hooks.state.example]
trusted_hash = "sha256:abc"
Actual behavior
On the original config, tomlkit.parse(text) succeeded, but doc.get("hooks") raised KeyAlreadyPresent: Key "Stop" already exists.
Versions tested
This reproduces with:
Python 3.12.7
tomlkit 0.14.0
tomlkit 0.15.0
tomlkit 0.15.0 produced the same class of traceback:
0.15.0
tomlkit.exceptions.KeyAlreadyPresent: Key "Stop" already exists.
Notes
The issue seems related to OutOfOrderTableProxy handling repeated array tables under a table that also contains sibling tables/subtables. Reordering the TOML so repeated [[hooks.Stop]] entries are grouped before other sibling tables avoids the failure in my application, but the original TOML should still be accessible after parsing.
Activity
Merge AoT fragments when building an out-of-order table proxy
Merge AoT fragments when building an out-of-order table proxy
Merge AoT fragments when building an out-of-order table proxy
Merge AoT fragments when building an out-of-order table proxy (python…
py-tomlkit: update to 0.15.1.
py-tomlkit: update to 0.15.1.