Commit d238db4b8e for bind
commit d238db4b8ee7ed409a26b7339d37622cddbb2e73
Author: Michal Nowak <mnowak@isc.org>
Date: Tue Dec 1 16:44:23 2026 +0000
Assert that the options grammar is a dict in mergegrammar.py
parse_mapbody() returns a (dict, flags) tuple when it reaches the "};"
that closes a nested map and a plain dict when it runs out of lines at
the top level. pylint 4.1.4 infers the tuple for the top-level call as
well and reports no-member and invalid-sequence-index errors in
combine(). State the top-level return type explicitly.
diff --git a/doc/arm/_ext/mergegrammar.py b/doc/arm/_ext/mergegrammar.py
index 74701a2ad6..8cbcf399cf 100644
--- a/doc/arm/_ext/mergegrammar.py
+++ b/doc/arm/_ext/mergegrammar.py
@@ -43,6 +43,9 @@ def read_zone():
def read_main():
with options_path.open(encoding="ascii") as fp:
optgrammar = parsegrammar.parse_mapbody(fp)
+ # parse_mapbody() returns a (dict, flags) tuple only when it reaches
+ # a "};" line, which must not appear at the top level of the file
+ assert isinstance(optgrammar, dict), f'unbalanced "}};" in {options_path}'
return optgrammar