Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-02-21 13:21:18 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-21 14:37:53 +0300
commit08dbc4f996e4e95f3ab64f7bb3e1193700c585f5 (patch)
tree8f9d121258c5f88cf825aa6e3030ccc7bbe983cd /release/scripts/startup/bl_operators/wm.py
parentde67e3c0c02e9d08022cff58338099d287505f91 (diff)
PyAPI: use postponed annotations to support Python 3.10
Support Python 3.10a5 or 3.9x with support explicitly enabled. - Enable Python's postponed annotations for Blender's RNA classes types registered on startup. - Using postponed annotations has implications for how they are defined, since they must evaluate in the modules name-space instead of the classes name-space. See changes to annotations in `release/scripts`. - Use `from __future__ import annotations` at the top of the module to ensure the script will run with Python 3.10. - Old logic is kept since it could be used if PEP-649 is supported. Resolves T83626 Ref D10474
Diffstat (limited to 'release/scripts/startup/bl_operators/wm.py')
-rw-r--r--release/scripts/startup/bl_operators/wm.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index c5457713d36..db15f4597bf 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -17,6 +17,7 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
+from __future__ import annotations
import bpy
from bpy.types import (
@@ -859,9 +860,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_OT_url_open_preset._preset_items,
)
id: StringProperty(
@@ -916,6 +915,10 @@ class WM_OT_url_open_preset(Operator):
"https://www.blender.org/about/credits/"),
]
+ @staticmethod
+ def _preset_items(_self, _context):
+ return (item for (item, _) in WM_OT_url_open_preset.preset_items)
+
def execute(self, context):
url = None
type = self.type