From ee835bf756685636b116c1ca76e1e8cce7432a2f Mon Sep 17 00:00:00 2001 From: Dusko Simidzija Date: Wed, 19 Aug 2020 02:14:39 +0200 Subject: [PATCH] fix field order breaking on py35/36 --- src/marshmallow/schema.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/marshmallow/schema.py b/src/marshmallow/schema.py index 9549e4673..26f00a480 100644 --- a/src/marshmallow/schema.py +++ b/src/marshmallow/schema.py @@ -397,7 +397,9 @@ def __init__( self.fields = {} # type: typing.Dict[str, ma_fields.Field] self.load_fields = {} # type: typing.Dict[str, ma_fields.Field] self.dump_fields = {} # type: typing.Dict[str, ma_fields.Field] - self.dump_serializers = {} # type: typing.Dict[str, typing.Callable] + self.dump_serializers = ( + self.dict_class() + ) # type: typing.Dict[str, typing.Callable] self._init_fields() messages = {} messages.update(self._default_error_messages) @@ -1043,7 +1045,7 @@ def _init_fields(self) -> None: self.fields = fields_dict self.dump_fields = dump_fields self.load_fields = load_fields - self.dump_serializers = {} + self.dump_serializers = self.dict_class() def on_bind_field(self, field_name: str, field_obj: ma_fields.Field) -> None: """Hook to modify a field when it is bound to the `Schema`.