Skip to content

Commit e63158e

Browse files
authored
Minor allow_none rework (#1551)
1 parent 685357d commit e63158e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/marshmallow/fields.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,9 @@ def __init__(
171171
"or a collection of callables."
172172
)
173173

174-
# If missing=None, None should be considered valid by default
175-
if allow_none is None:
176-
if missing is None:
177-
self.allow_none = True
178-
else:
179-
self.allow_none = False
180-
else:
181-
self.allow_none = allow_none
174+
# If allow_none is None and missing is None
175+
# None should be considered valid by default
176+
self.allow_none = missing is None if allow_none is None else allow_none
182177
self.load_only = load_only
183178
self.dump_only = dump_only
184179
if required is True and missing is not missing_:

0 commit comments

Comments
 (0)