Re: [PATCH v2 3/3] kunit: tool: fix unintentional statefulness in run_kernel()

2021-02-04 Thread Brendan Higgins
On Thu, Feb 4, 2021 at 9:31 AM Daniel Latypov wrote: > > This is a bug that has been present since the first version of this > code. > Using [] as a default parameter is dangerous, since it's mutable. > > Example using the REPL: > >>> def bad(param = []): > ... param.append(len(param)) > ...

[PATCH v2 3/3] kunit: tool: fix unintentional statefulness in run_kernel()

2021-02-04 Thread Daniel Latypov
This is a bug that has been present since the first version of this code. Using [] as a default parameter is dangerous, since it's mutable. Example using the REPL: >>> def bad(param = []): ... param.append(len(param)) ... print(param) ... >>> bad() [0] >>> bad() [0, 1] This wasn't a