From 65047099b2618d67b2e78e71318fdff4e7c3af16 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Jun 2013 11:35:25 +0000 Subject: [PATCH] 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() --- source/blender/python/intern/bpy_rna.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 53340437e07..76e64ebba6e 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3425,11 +3425,14 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr) 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; }