From 21836cd60bc9bcb2a7043bbeb1c308b6759210d6 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Mon, 9 Sep 2024 20:55:05 +1200 Subject: [PATCH 1/2] Inspect __init__ explicitly, for 3.8 compatibility. --- scenario/state.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scenario/state.py b/scenario/state.py index e7190ea5..9179735d 100644 --- a/scenario/state.py +++ b/scenario/state.py @@ -139,12 +139,13 @@ def __new__(cls, *args, **kwargs): # declared, which aligns with dataclasses. Simpler ways of # getting the arguments (like __annotations__) do not have that # guarantee, although in practice it is the case. - parameters = inspect.signature(cls).parameters + parameters = inspect.signature(cls.__init__).parameters required_args = [ name for name in tuple(parameters) if parameters[name].default is inspect.Parameter.empty and name not in kwargs + and name != "self" ] n_posargs = len(args) max_n_posargs = cls._max_positional_args From 199581b47aa3448378530831cf1ae64f17c628f2 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Mon, 9 Sep 2024 20:55:21 +1200 Subject: [PATCH 2/2] Bump version. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eb6695b4..f8c89a48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "ops-scenario" -version = "7.0.0" +version = "7.0.1" authors = [ { name = "Pietro Pasotti", email = "pietro.pasotti@canonical.com" }