`update()` on an out-of-order table raises `IndexError` after a sub-table fragment was popped
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Start with the reproduced tomlkit call in the issue and inspect tomlkit/container.py around __setitem__ line 1262, where the traceback indexes _tables. Compare the failing update() call with setting the same keys individually after pop. Done means the update no longer raises IndexError and the document can be dumped as expected.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Versions tested: tomlkit 0.15.2 from PyPI (the newest release on 2026-10-21) and the master branch at
eddd27e43a62fe58707c311bfad2f52e72493f53 (its head on 2026-10-21); Python 3.11.10 on Linux.
Reproduce (one command):
python3 -c '
import tomlkit
doc = tomlkit.parse("[y.y.b]\nc = 1\n[y]\nd = 1\n[y.b]\ne = 2\n[y.y]\n")
doc["y"]["y"].pop("b")
doc["y"].update({"y": [{"z": 1}], "b": {"e": -0.5}})
print(tomlkit.dumps(doc))
'
The document is valid TOML: tomllib.loads reads it as {'y': {'y': {'b': {'c': 1}}, 'd': 1, 'b': {'e': 2}}}.
Expected: the update succeeds and the document can be dumped.
Observed (the same on both versions):
File ".../tomlkit/container.py", line 1262, in __setitem__
old_value = self._tables[map_indices[0]][key]
~~~~~~~~~~~~^^^^^^^^^^^^^^^^
IndexError: list index out of range
Setting the two keys one at a time (doc["y"]["y"] = [{"z": 1}], then doc["y"]["b"] = {"e": -0.5}) after the same pop does not
raise. We have not looked for the cause.
Found while testing tomlkit's editing API against the standard library's tomllib with generated documents.
Possibly related: #196 (out-of-order sections), though that report is about _insert_after, not update().
- Lenguaje dominante
- Python
- Estrellas
- 861
- Forks
- 201
- Merge medio
- 3 d 23 h
- PR fusionados (30 d)
- 30
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-poetry/tomlkit
-
Speed up array appendsPosiblemente ocupada @harshitgupta31415 la tomó hace 12 días. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 42/100
python-poetry/tomlkit#665 ·
Los mantenedores suelen responder en 2 días
-
Deleting the last key under a dotted key in an inline table produces invalid TOMLPosiblemente ocupada @cig13zs la tomó hace 13 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
python-poetry/tomlkit#662 ·
Los mantenedores suelen responder en 2 días
-
AttributeError on an out-of-order table under an indented header (4+ levels)Posiblemente ocupada @cig13zs la tomó hace 13 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 18/100
python-poetry/tomlkit#661 ·
Los mantenedores suelen responder en 2 días
-
In-place array repetition changes values without updating serialized TOMLPosiblemente ocupada @harbinresearcher la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
python-poetry/tomlkit#646 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
tomlkit 0.15.1 fails on out-of-order table headerQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
python-poetry/tomlkit#632 ·
Los mantenedores suelen responder en 2 días
Todos los issues de python-poetry/tomlkit
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
glossyio/traffic-monitor#264 ·
Los mantenedores suelen responder en 1 día
-
Add self-hostAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Atarity/deploy-your-own-saas#102 ·
-
[Bug]: RDFlex silently drops the covariate adjustment when the outcome or treatment column is integer-typedPosiblemente ocupada @vrjdev la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
DoubleML/doubleml-for-py#424 ·
Los mantenedores suelen responder en 1 día
-
agentic-dmx docs enhancement
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
521xueweihan/HelloGitHub#4150 ·