From ab85568d04ae4199503a4704a4fd261c4a3e4c12 Mon Sep 17 00:00:00 2001 From: fabian Date: Fri, 6 Dec 2024 18:32:47 +0100 Subject: [PATCH] fix(config): Fix init_kwargs handling --- src/gallia/command/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallia/command/config.py b/src/gallia/command/config.py index 9ea20da2e..1bf4c6f09 100644 --- a/src/gallia/command/config.py +++ b/src/gallia/command/config.py @@ -301,8 +301,14 @@ class GalliaBaseModel(BaseCommand, ABC): __config_registry: dict[str, tuple[str, Any]] def __init__(self, **data: Any): - # Copy to avoid side effects when reusing init_kwargs - init_kwargs = dict(data.pop("init_kwargs", {})) + init_kwargs = data.pop("init_kwargs", {}) + + if init_kwargs is None: + init_kwargs = {} + else: + # Copy to avoid side effects when reusing init_kwargs + init_kwargs = dict(init_kwargs) + init_kwargs.update(data) super().__init__(**init_kwargs)