Skip to content

Commit

Permalink
Merge pull request #153 from ermakov-oleg/fix-forward-ref
Browse files Browse the repository at this point in the history
Fixed support ForwardRef for Python 3.12.4
  • Loading branch information
ermakov-oleg authored Jun 15, 2024
2 parents 3a865ce + 8d24bfd commit e75ca74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/serpyco_rs/_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def _evaluate_forwardref(t: type[_T], meta: Meta) -> type[_T]:
if not isinstance(t, ForwardRef):
return t

return t._evaluate(meta.globals, {}, set())
return t._evaluate(meta.globals, {}, recursive_guard=set())


def _get_discriminator_value(t: Any, name: str) -> str:
Expand Down
8 changes: 8 additions & 0 deletions src/python/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ pub enum Type<'a, Base = Bound<'a, BaseType>> {
Float(Bound<'a, FloatType>, Base),
Decimal(Bound<'a, DecimalType>, Base),
String(Bound<'a, StringType>, Base),
#[allow(dead_code)]
Boolean(Bound<'a, BooleanType>, Base),
#[allow(dead_code)]
Uuid(Bound<'a, UUIDType>, Base),
#[allow(dead_code)]
Bytes(Bound<'a, BytesType>, Base),
#[allow(dead_code)]
Time(Bound<'a, TimeType>, Base),
#[allow(dead_code)]
DateTime(Bound<'a, DateTimeType>, Base),
#[allow(dead_code)]
Date(Bound<'a, DateType>, Base),
Entity(Bound<'a, EntityType>, Base, usize),
TypedDict(Bound<'a, TypedDictType>, Base, usize),
Expand All @@ -31,8 +37,10 @@ pub enum Type<'a, Base = Bound<'a, BaseType>> {
DiscriminatedUnion(Bound<'a, DiscriminatedUnionType>, Base),
Union(Bound<'a, UnionType>, Base),
Literal(Bound<'a, LiteralType>, Base),
#[allow(dead_code)]
Any(Bound<'a, AnyType>, Base),
RecursionHolder(Bound<'a, RecursionHolder>, Base),
#[allow(dead_code)]
Custom(Bound<'a, CustomType>, Base),
}

Expand Down

0 comments on commit e75ca74

Please sign in to comment.