From 13182293fb3c726e5ae5b46c8fd549b954de7c3e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 7 Mar 2023 18:57:39 -0500 Subject: [PATCH] Fix matter_yamltests with Python 11. (#25539) Due to https://docs.python.org/3.11/whatsnew/3.11.html#dataclasses, the previous code fails: it's using mutable class instances as default values of dataclass fields. --- .../py_matter_yamltests/matter_yamltests/parser_builder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser_builder.py b/scripts/py_matter_yamltests/matter_yamltests/parser_builder.py index ae4458ae6990af..72ebae6a1fff8f 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/parser_builder.py +++ b/scripts/py_matter_yamltests/matter_yamltests/parser_builder.py @@ -51,9 +51,10 @@ class TestParserBuilderConfig: current parsing state. """ tests: list[str] = field(default_factory=list) - parser_config: TestParserConfig = TestParserConfig() + parser_config: TestParserConfig = field(default_factory=TestParserConfig) hooks: TestParserHooks = TestParserHooks() - options: TestParserBuilderOptions = TestParserBuilderOptions() + options: TestParserBuilderOptions = field( + default_factory=TestParserBuilderOptions) class TestParserBuilder: