Skip to content

Commit

Permalink
Schema._deserialize: use func rather than lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrech committed Dec 11, 2022
1 parent e0cc289 commit f8d13c4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/marshmallow/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,17 @@ def _deserialize(
d_kwargs["partial"] = sub_partial
else:
d_kwargs["partial"] = partial
# lambda function does not bind loop variables
# but we don't mind since we call getter in this iteration
getter = lambda val: field_obj.deserialize( # noqa: B023
val,
field_name, # noqa: B023
data,
**d_kwargs, # noqa: B023
)

def getter(
val, field_obj=field_obj, field_name=field_name, d_kwargs=d_kwargs
):
return field_obj.deserialize(
val,
field_name,
data,
**d_kwargs,
)

value = self._call_and_store(
getter_func=getter,
data=raw_value,
Expand Down

0 comments on commit f8d13c4

Please sign in to comment.