Skip to content

Commit ad643c7

Browse files
committed
Fix
1 parent 1536601 commit ad643c7

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/cattrs/gen/__init__.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,6 @@ def make_dict_structure_fn_from_attrs(
552552
for a in attrs:
553553
an = a.name
554554

555-
if a.default is not NOTHING:
556-
non_required.append(a)
557-
# The next loop will handle it.
558-
continue
559-
560555
if an in kwargs:
561556
override = kwargs[an]
562557
else:
@@ -569,6 +564,11 @@ def make_dict_structure_fn_from_attrs(
569564
if override.omit is None and not a.init and not _cattrs_include_init_false:
570565
continue
571566

567+
if a.default is not NOTHING:
568+
non_required.append(a)
569+
# The next loop will handle it.
570+
continue
571+
572572
t = a.type
573573
if isinstance(t, TypeVar):
574574
t = typevar_map.get(t.__name__, t)
@@ -636,12 +636,7 @@ def make_dict_structure_fn_from_attrs(
636636

637637
for a in non_required:
638638
an = a.name
639-
if an in kwargs:
640-
override = kwargs[an]
641-
else:
642-
override = _annotated_override_or_default(a.type, neutral)
643-
if override != neutral:
644-
kwargs[an] = override
639+
override = kwargs.get(an, neutral)
645640
t = a.type
646641
if isinstance(t, TypeVar):
647642
t = typevar_map.get(t.__name__, t)

0 commit comments

Comments
 (0)