Fail closed on invalid node mapping keys

This commit is contained in:
2026-07-02 16:39:06 +02:00
parent 2c9452ae67
commit f26e441e03
2 changed files with 26 additions and 1 deletions
+3 -1
View File
@@ -1060,7 +1060,9 @@ def _node_class_mappings(tree):
_mapping_value_binding,
_node_mapping_invalidated_by_names,
)
return {str(node_type): binding for node_type, (_class_name, binding) in mappings.items() if node_type}
if not all(isinstance(node_type, str) for node_type in mappings):
return {}
return {node_type: binding for node_type, (_class_name, binding) in mappings.items() if node_type}
def _display_mappings(tree):