Skip to content

Commit ef3e523

Browse files
committed
fix: optional type var for Resource with python 3.13+
1 parent 4789645 commit ef3e523

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scim2_models/resources/resource.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from datetime import datetime
23
from typing import TYPE_CHECKING
34
from typing import Annotated
@@ -102,7 +103,11 @@ def from_schema(cls, schema: "Schema") -> type["Extension"]:
102103
return _make_python_model(schema, cls)
103104

104105

105-
AnyExtension = TypeVar("AnyExtension", bound="Extension")
106+
# TypeVar with default parameter is available in Python 3.13+
107+
if sys.version_info >= (3, 13):
108+
AnyExtension = TypeVar("AnyExtension", bound="Extension", default="Extension")
109+
else: # pragma: no cover
110+
AnyExtension = TypeVar("AnyExtension", bound="Extension")
106111

107112
_PARAMETERIZED_CLASSES: dict[tuple[type, tuple[Any, ...]], type] = {}
108113

0 commit comments

Comments
 (0)