changeset 48:a0b464f6ab1f

FIX: Allow only real _Schema instances as schemas in a Context
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 03 Aug 2023 02:19:46 +0200
parents e7f6fc454f84
children 6b8fcd0d2175
files data_schema/__init__.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/data_schema/__init__.py	Wed Aug 02 17:54:16 2023 +0200
+++ b/data_schema/__init__.py	Thu Aug 03 02:19:46 2023 +0200
@@ -440,6 +440,9 @@
                  current_object=_SENTINEL,
                  settings=_SENTINEL,
                  key_index=_SENTINEL):
+        if root_schema is not _SENTINEL:
+            if not isinstance(root_schema, _Schema):
+                raise TypeError("schema must be a `_Schema' not a pure `dict'")
         if parent is None:
             if key is not _SENTINEL:
                 raise TypeError("the root context may not have a key")