From fef4dc7269099eeac452a14e68c475357d12ee6e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 11 Oct 2021 12:53:52 +1100 Subject: [PATCH] Fix starting Blender with Python 3.10 URL presets weren't working, raising a Python exception when the splash screen was displayed. --- release/scripts/startup/bl_operators/wm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 17552b6e013..280df736c18 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -979,6 +979,12 @@ class WM_OT_url_open(Operator): return {'FINISHED'} +# NOTE: needed for Python 3.10 since there are name-space issues with annotations. +# This can be moved into the class as a static-method once Python 3.9x is dropped. +def _wm_url_open_preset_type_items(_self, _context): + return [item for (item, _) in WM_OT_url_open_preset.preset_items] + + class WM_OT_url_open_preset(Operator): """Open a preset website in the web browser""" bl_idname = "wm.url_open_preset" @@ -987,9 +993,7 @@ class WM_OT_url_open_preset(Operator): type: EnumProperty( name="Site", - items=lambda self, _context: ( - item for (item, _) in WM_OT_url_open_preset.preset_items - ), + items=_wm_url_open_preset_type_items, ) id: StringProperty(