[Bf-blender-cvs] [fef4dc72690] master: Fix starting Blender with Python 3.10

Campbell Barton noreply at git.blender.org
Mon Oct 11 04:10:42 CEST 2021


Commit: fef4dc7269099eeac452a14e68c475357d12ee6e
Author: Campbell Barton
Date:   Mon Oct 11 12:53:52 2021 +1100
Branches: master
https://developer.blender.org/rBfef4dc7269099eeac452a14e68c475357d12ee6e

Fix starting Blender with Python 3.10

URL presets weren't working, raising a Python exception
when the splash screen was displayed.

===================================================================

M	release/scripts/startup/bl_operators/wm.py

===================================================================

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(



More information about the Bf-blender-cvs mailing list