File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ import sys
12import types
23from contextlib import contextmanager
34from contextvars import ContextVar
@@ -123,7 +124,14 @@ def init_pydantic_private_attrs(new_object: InstanceOrType["SQLModel"]) -> None:
123124 object .__setattr__ (new_object , "__pydantic_private__" , None )
124125
125126 def get_annotations (class_dict : Dict [str , Any ]) -> Dict [str , Any ]:
126- return class_dict .get ("__annotations__" , {}) # type: ignore[no-any-return]
127+ raw_annotations : dict [str , Any ] = class_dict .get ("__annotations__" , {})
128+ if sys .version_info >= (3 , 14 ) and "__annotations__" not in class_dict :
129+ # See https://github.com/pydantic/pydantic/pull/11991
130+ from annotationlib import Format , call_annotate_function , get_annotate_from_class_namespace
131+
132+ if annotate := get_annotate_from_class_namespace (class_dict ):
133+ raw_annotations = call_annotate_function (annotate , format = Format .FORWARDREF )
134+ return raw_annotations
127135
128136 def is_table_model_class (cls : Type [Any ]) -> bool :
129137 config = getattr (cls , "model_config" , {})
You can’t perform that action at this time.
0 commit comments