[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57429] trunk/blender/source/blender/ python/intern/bpy_rna.c: fix for pythons __dir__ returning registrable functions on class instances (which may not have the functions defined).

Campbell Barton ideasman42 at gmail.com
Thu Jun 13 13:35:25 CEST 2013


Revision: 57429
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57429
Author:   campbellbarton
Date:     2013-06-13 11:35:25 +0000 (Thu, 13 Jun 2013)
Log Message:
-----------
fix for pythons __dir__ returning registrable functions on class instances (which may not have the functions defined).
gave odd behavior of including members in __dir__ that couldn't getattr()

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2013-06-13 11:10:18 UTC (rev 57428)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2013-06-13 11:35:25 UTC (rev 57429)
@@ -3425,11 +3425,14 @@
 
 		RNA_PROP_BEGIN (&tptr, itemptr, iterprop)
 		{
-			idname = RNA_function_identifier(itemptr.data);
+			FunctionRNA *func = itemptr.data;
+			if (RNA_function_defined(func)) {
+				idname = RNA_function_identifier(itemptr.data);
 
-			pystring = PyUnicode_FromString(idname);
-			PyList_Append(list, pystring);
-			Py_DECREF(pystring);
+				pystring = PyUnicode_FromString(idname);
+				PyList_Append(list, pystring);
+				Py_DECREF(pystring);
+			}
 		}
 		RNA_PROP_END;
 	}




More information about the Bf-blender-cvs mailing list