tomlkit 0.15.1 fails on out-of-order table header

Offen
#632 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

  • #636 von @0xrutabaga — ohne Merge geschlossen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
tooling

Rechercherichtung

Reproduce with the given document: tomlkit.loads fails with Key "b" already exists while tomllib.loads succeeds. Start from tomlkit's table/key parsing path (the loads entry point and how dotted keys and later [a.b.e] headers merge into an existing [a] table). Done when that document and similar out-of-order headers parse without error and round-trip without changing unrelated style.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

tomlkit 0.15.1 and earlier fail to parse out-of-order table header. The following example is valid TOML and loads fine with stdlib tomllib.

import tomllib, tomlkit

doc = """\
[a]
b.c = 1
b.d = 2

[x]
y = 1

[a.b.e]
f = 3
"""

tomllib.loads(doc)   # OK
tomlkit.loads(doc)   # ParseError: Key "b" already exists. at line 9 col 0

We noticed this problem while parsing the pyproject.toml file of geventhttpclient-2.5.0 https://raw.githubusercontent.com/geventhttpclient/geventhttpclient/refs/tags/2.5.0/pyproject.toml . See https://github.com/python-wheel-build/fromager/issues/1356

Vorherrschende Sprache
Python
Sterne
864
Forks
207
Ø Merge
3 T. 23 Std.
Gemergte PRs (30 T.)
25

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python-poetry/tomlkit

Alle Issues in python-poetry/tomlkit

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.