App.find_dir/__find_dir(): Fix mutable default args
Mutable default arguments (list) cause unexpected shared state between calls. Use None as default and initialise to [] inside the function body.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.devSigned-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
a61a55c696
commit
59a0e2ada8
1 changed files with 8 additions and 4 deletions
|
|
@ -126,10 +126,14 @@ class App(Base):
|
|||
def __find_dir(
|
||||
self,
|
||||
name: str,
|
||||
search_subdirs: list[str] = [],
|
||||
search_absdirs: list[str] = [],
|
||||
search_subdirs: list[str] | None = None,
|
||||
search_absdirs: list[str] | None = None,
|
||||
pretty: bool = True,
|
||||
) -> str | None:
|
||||
if search_subdirs is None:
|
||||
search_subdirs = []
|
||||
if search_absdirs is None:
|
||||
search_absdirs = []
|
||||
|
||||
def __format_relpath(path: str):
|
||||
if path.startswith('./'):
|
||||
|
|
@ -488,8 +492,8 @@ class App(Base):
|
|||
def find_dir(
|
||||
self,
|
||||
name: str,
|
||||
search_subdirs: list[str] = [],
|
||||
search_absdirs: list[str] = [],
|
||||
search_subdirs: list[str] | None = None,
|
||||
search_absdirs: list[str] | None = None,
|
||||
pretty: bool = True,
|
||||
throw: bool = False,
|
||||
) -> str | None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue