Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`update()` on an out-of-order table raises `IndexError` after a sub-table fragment was popped

Abierto
#675 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@rajmodi8905 ya está trabajando en esto.

Desde el 22/10/2026.

  • #677 de @rajmodi8905 — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python-poetry/tomlkit

Todos los issues de python-poetry/tomlkit

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.