8000 Do not cache parametrized models when in the process of parametrizing… · pydantic/pydantic@c6bff2e · GitHub
[go: up one dir, main page]

Skip to content

Commit c6bff2e

Browse files
committed
Do not cache parametrized models when in the process of parametrizing another model
1 parent 76222d2 commit c6bff2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pydantic/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,8 @@ def __class_getitem__(
805805
submodel = _generics.create_generic_submodel(model_name, origin, args, params)
806806

807807
# Update cache
808-
_generics.set_cached_generic_type(cls, typevar_values, submodel, origin, args)
808+
if len(_generics.recursively_defined_type_refs()) == 1:
809+
_generics.set_cached_generic_type(cls, typevar_values, submodel, origin, args)
809810

810811
return submodel
811812

0 commit comments

Comments
 (0)
0