diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 588f08224c892a57a24710a74be9de0f4929e69e..eaa8b82e4d78e67a3a80c3ea3065e981c69f42c8 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -745,7 +745,7 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
 
 static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
 {
-	return (a->ptr.data == b->ptr.data) ? 0 : -1;
+	return (a->ptr.data == b->ptr.data && a->ptr.type == b->ptr.type) ? 0 : -1;
 }
 
 static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)