Page MenuHome

PyAPI: use postponed annotations to support Python 3.10
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Feb 19 2021, 4:06 PM.

Details

Summary

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


This is an initial patch to get Python 3.10 working with annotations.

Other commits for Python 3.10 support which have been committed to master.

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 13003
Build 13003: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Feb 19 2021, 4:06 PM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) retitled this revision from Initial Python 3.10 support to PyAPI: support un-evaluated annotations (Python 3.10 support).Feb 19 2021, 4:18 PM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) retitled this revision from PyAPI: support un-evaluated annotations (Python 3.10 support) to PyAPI: use postponed annotations to support Python 3.10.Feb 21 2021, 9:37 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Rebase on master
  • Enable future annotations for cycles
This revision was not accepted when it landed; it landed in state Needs Review.Feb 21 2021, 12:39 PM
This revision was automatically updated to reflect the committed changes.