diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-11 04:53:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-11 04:58:12 +0300 |
commit | fef4dc7269099eeac452a14e68c475357d12ee6e (patch) | |
tree | 79c5bcb60056b63c057b732fb7e7882d345e8d78 | |
parent | d2454487d1ee97caa270478aa0ef0bc8e5471ea1 (diff) |
Fix starting Blender with Python 3.10
URL presets weren't working, raising a Python exception
when the splash screen was displayed.
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 10 |
1 files 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( |