State.wipe() with no arguments raises TypeError instead of clearing state

Abierto Apto para principiantes
#1,030 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@alibb007 ya está trabajando en esto.

Desde el 6/11/2026.

  • #1031 de @alibb007 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
79/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Empieza por burr/core/state.py, en State.wipe() alrededor de la línea 440, y lee cómo el método gestiona delete y keep. Reproduce el fallo indicado con el ejemplo del issue y, después, comprueba si hay pruebas que cubran wipe() sin argumentos. Se considera terminado cuando la llamada devuelve un estado vacío sin generar un TypeError.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

status/needs-triage
What happens

wipe() says that calling it with no arguments deletes the whole state. When both delete and keep are None, the code skips the delete branch and runs [key for key in self._state if key not in keep] with keep=None. Python's in operator raises TypeError on None, so the call fails before anything is deleted. I read this from the code only. I did not run it.

Where

burr/core/state.py:440

To reproduce
from burr.core.state import State

state = State({"a": 1, "b": 2})
assert state.wipe().get_all() == {}
Expected

State({"a": 1, "b": 2}).wipe() returns an empty state.

Actual

Raises TypeError (argument of type 'NoneType' is not iterable), based on the code path above. Not run.

    assert state.wipe().get_all() == {}
           ~~~~~~~~~~^^
  File "/Users/alibb/.ali-hq/work/gh/apache__burr/burr/core/state.py", line 440, in wipe
    fields_to_delete = [key for key in self._state if key not in keep]
                                                      ^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not a container or iterable

Checked on cdea4eb.

Lenguaje dominante
Python
Estrellas
2.6k
Forks
218
Merge medio
4 d 8 h
PR fusionados (30 d)
35

Preparar el entorno

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 apache/burr

Todos los issues de apache/burr

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.