Fix T86765: Custom properties are included in `__dir__`

Remove custom properties from `__dir__` method result since these
can't be accessed using `__getattr__`.

Introduced in the 2.5x Python API update.
This commit is contained in:
Campbell Barton 2021-04-23 17:05:41 +10:00
parent 0817763624
commit dc1e98d8a0
Notes: blender-bot 2023-02-14 05:53:38 +01:00
Referenced by issue #86765, Error accessing custom properties?
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 4 additions and 0 deletions

View File

@ -4207,6 +4207,10 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
iterprop = RNA_struct_iterator_property(ptr->type);
RNA_PROP_BEGIN (ptr, itemptr, iterprop) {
/* Custom-properties are exposed using `__getitem__`, exclude from `__dir__`. */
if (RNA_property_is_idprop(itemptr.data)) {
continue;
}
nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {