From 924c58bde38c0b97f35e746b3d1367aa7f6c907b Mon Sep 17 00:00:00 2001 From: ines Date: Fri, 2 Jun 2017 18:18:17 +0200 Subject: [PATCH] Fix serialization of optional elements --- spacy/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index a70e3883b..55f2a49bb 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -429,7 +429,7 @@ def to_bytes(getters, exclude): def from_bytes(bytes_data, setters, exclude): msg = msgpack.loads(bytes_data, encoding='utf8') for key, setter in setters.items(): - if key not in exclude: + if key not in exclude and key in msg: setter(msg[key]) return msg