From c795cdc655ef57c8ca770e0ee4f949e9c2977ec3 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 6 Apr 2025 09:00:23 +0200 Subject: [PATCH] registry.Json: Fix serialization/deserialization points self.value should be the deserialized value (because we set 'self.value = default' in registry.close()), so setValue()/__call__() should return it as-is. Doing otherwise failed serialization of the default, and crashed with the same error as in https://github.com/progval/Limnoria/issues/1604 since 8ec873015aac3ba4193a2d498eb294975615b296 --- src/registry.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/registry.py b/src/registry.py index 8a18d9627..eb9620fdf 100644 --- a/src/registry.py +++ b/src/registry.py @@ -920,13 +920,11 @@ class TemplatedString(String): class Json(String): __slots__ = () - # Json-serializable data + def set(self, v): self.setValue(json.loads(v)) - def setValue(self, v): - super(Json, self).setValue(json.dumps(v)) - def __call__(self): - return json.loads(super(Json, self).__call__()) + def __str__(self): + return json.dumps(self()) class _Context: def __init__(self, var):