Skip to content

Commit 127f214

Browse files
authored
Merge pull request yukinarit#119 from yukinarit/remove-self-class-from-scope
refactor: Remove self class from scope
2 parents 47a8dde + da81f1f commit 127f214

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

serde/de.py

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ def wrap(cls: Type):
122122

123123
# Collect types used in the generated code.
124124
for typ in iter_types(cls):
125+
if typ is cls:
126+
continue
127+
125128
if is_dataclass(typ) or is_enum(typ) or not is_primitive(typ):
126129
scope.types[typ.__name__] = typ
127130

serde/se.py

+3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ def wrap(cls: Type):
133133

134134
# Collect types used in the generated code.
135135
for typ in iter_types(cls):
136+
if typ is cls:
137+
continue
138+
136139
if is_dataclass(typ) or is_enum(typ) or not is_primitive(typ):
137140
scope.types[typ.__name__] = typ
138141

0 commit comments

Comments
 (0)