use safe issubclass

This commit is contained in:
Khaleel Al-Adhami 2025-02-05 15:42:49 -08:00
parent 86d335007a
commit 7a058ea258

View File

@ -22,7 +22,12 @@ from typing_extensions import is_typeddict
from reflex.utils import types from reflex.utils import types
from reflex.utils.exceptions import VarAttributeError from reflex.utils.exceptions import VarAttributeError
from reflex.utils.types import GenericType, get_attribute_access_type, get_origin from reflex.utils.types import (
GenericType,
get_attribute_access_type,
get_origin,
safe_issubclass,
)
from .base import ( from .base import (
CachedVarOperation, CachedVarOperation,
@ -268,7 +273,7 @@ class ObjectVar(Var[OBJECT_TYPE], python_types=Mapping):
if ( if (
is_typeddict(fixed_type) is_typeddict(fixed_type)
or (isclass(fixed_type) and not issubclass(fixed_type, Mapping)) or (isclass(fixed_type) and not safe_issubclass(fixed_type, Mapping))
or (fixed_type in types.UnionTypes) or (fixed_type in types.UnionTypes)
): ):
attribute_type = get_attribute_access_type(var_type, name) attribute_type = get_attribute_access_type(var_type, name)