[Bf-blender-cvs] [cf60027] master: Don't make Python classes of StructRNA on startup

Campbell Barton noreply at git.blender.org
Wed Jul 22 11:56:32 CEST 2015


Commit: cf6002737da7a842650d47569385467f4812cb78
Author: Campbell Barton
Date:   Wed Jul 22 19:41:59 2015 +1000
Branches: master
https://developer.blender.org/rBcf6002737da7a842650d47569385467f4812cb78

Don't make Python classes of StructRNA on startup

This gives small start time speedup, classes are lazy loaded instead.

Keep existing behavior in debug builds to catch any errors early.

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

M	source/blender/python/intern/bpy_rna.c

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

diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index d15e3b3..af4b239 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -7446,8 +7446,14 @@ static void bpy_class_free(void *pyob_ptr)
 	PyGILState_Release(gilstate);
 }
 
+/**
+ * \note This isn't essential to run on startup, since subtypes will lazy initialize.
+ * But keep running in debug mode so we get immediate notification of bad class hierarchy
+ * or any errors in "bpy_types.py" at load time, so errors don't go unnoticed.
+ */
 void pyrna_alloc_types(void)
 {
+#ifdef DEBUG
 	PyGILState_STATE gilstate;
 
 	PointerRNA ptr;
@@ -7475,6 +7481,7 @@ void pyrna_alloc_types(void)
 	RNA_PROP_END;
 
 	PyGILState_Release(gilstate);
+#endif  /* DEBUG */
 }




More information about the Bf-blender-cvs mailing list