More python 3.14 fixes, see 9bac66a

This commit is contained in:
Bruno Postle
2026-01-03 21:58:05 +00:00
parent 9bac66a01b
commit c20ed44a0f
3 changed files with 35 additions and 7 deletions
+10 -2
View File
@@ -96,7 +96,11 @@ class PanelSpy:
def __getattr__(self, attr: str) -> PanelSpy | Any:
self.spied_attr = attr
if annotation := self.blender_panel.__annotations__.get(attr, None):
try:
annotations = self.blender_panel.__annotations__
except AttributeError:
annotations = type(self.blender_panel).__annotations__
if annotation := annotations.get(attr, None):
return annotation.keywords.get("default", None) # An operator property
if attr == "layout":
return self
@@ -136,7 +140,11 @@ class PanelSpy:
prop_type = props.bl_rna.properties[name].type
enum_items = []
if prop_type == "ENUM":
prop_keywords = props.__annotations__[name].keywords
try:
annotations = props.__annotations__
except AttributeError:
annotations = type(props).__annotations__
prop_keywords = annotations[name].keywords
items = prop_keywords.get("items")
if items is not None:
if isinstance(items, (list, tuple)):