From 595b12b4d5b30c5dd2d168f830d86165be6319ce 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 e74ed87a9..b11ff8d18 100644 --- a/src/marshmallow/schema.py +++ b/src/marshmallow/schema.py @@ -395,7 +395,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) @@ -1041,7 +1043,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`.