support python < 3.9

This commit is contained in:
John Lyu 2025-02-05 14:23:02 +08:00
parent b1ed8c36ca
commit 5d1bf5c2f3

View File

@ -550,8 +550,9 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
# thus pydantic will use the value of the attribute as the default value # thus pydantic will use the value of the attribute as the default value
base_annotations.update(dict_used["__annotations__"]) base_annotations.update(dict_used["__annotations__"])
dict_used["__annotations__"] = base_annotations dict_used["__annotations__"] = base_annotations
base_fields.update(dict_used)
new_cls = super().__new__( new_cls = super().__new__(
cls, name, bases, base_fields | dict_used, **config_kwargs cls, name, bases, base_fields, **config_kwargs
) )
new_cls.__annotations__ = { new_cls.__annotations__ = {
**relationship_annotations, **relationship_annotations,