Skip to content

Commit 56cd0cf

Browse files
xr843claude
andcommitted
Fixed Pydantic API compatibility for ModelPrivateAttr.get_default (#149)
Pydantic 2.x's ModelPrivateAttr.get_default() takes no arguments and handles both default and default_factory internally. Removed the call_default_factory=True kwarg that caused TypeError on Pydantic >=2.11. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e0e7863 commit 56cd0cf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sqlmodel/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def init_pydantic_private_attrs(new_object: InstanceOrType["SQLModel"]) -> None:
102102
private_attributes = getattr(cls, "__private_attributes__", {})
103103
pydantic_private = {}
104104
for k, v in private_attributes.items():
105-
pydantic_private[k] = v.get_default(call_default_factory=True)
105+
pydantic_private[k] = v.get_default()
106106
object.__setattr__(
107107
new_object,
108108
"__pydantic_private__",

0 commit comments

Comments
 (0)