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

オープン 初心者向け
#1,030 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@alibb007 がすでに取り組んでいます。

2026年11月6日 から。

  • #1031 @alibb007 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
79/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

burr/core/state.py の440行目付近にある State.wipe() から始め、メソッドが delete と keep をどのように処理するかを読みます。issue の例で報告された失敗を再現し、その後、引数なしの wipe() を対象とするテストがあるか確認します。呼び出しが TypeError を発生させずに空の状態を返せば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
2.6k
フォーク
218
平均マージ
4日 8時間
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/burr のほかの issue

apache/burr の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。