alibb007 opened a new issue, #1030:
URL: https://github.com/apache/burr/issues/1030

   ### 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`](https://github.com/apache/burr/blob/cdea4ebdd202461c26b0f5a1b7c1ec259fb138e1/burr/core/state.py#L440)
   
   ### To reproduce
   ```python
   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`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to