From 38662b22a607e9aa7e49046b6e923a3c19dc2f12 Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Mon, 25 Jul 2022 12:03:37 +0200 Subject: [PATCH] meta: fix lookup of invalid schemata We need to initialize `schema` to `None`, otherwise it will be an access to an uninitialized variable when looking up invalid schemata: [...] File "[...]/osbuild/meta.py", line 583, in get_schema schema = Schema(schema, name or klass) UnboundLocalError: local variable 'schema' referenced before assignment Signed-off-by: David Rheinsberg --- osbuild/meta.py | 1 + 1 file changed, 1 insertion(+) diff --git a/osbuild/meta.py b/osbuild/meta.py index c3f73e29..5b540f5f 100644 --- a/osbuild/meta.py +++ b/osbuild/meta.py @@ -564,6 +564,7 @@ class Index: `None` and any validation will fail. """ cached_schema: Optional[Schema] = self._schemata.get((klass, name, version)) + schema = None if cached_schema is not None: return cached_schema