From 9c9ee244115bb53758d01e373e5525d4ee66ca83 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 29 May 2017 13:23:28 -0500 Subject: [PATCH] Fix broken lambda scoping in Python 2 --- spacy/language.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index 8f1ae69ca..b6f719276 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -439,7 +439,7 @@ class Language(object): continue if not hasattr(proc, 'to_bytes'): continue - serializers[i] = lambda: proc.to_bytes(vocab=False) + serializers[i] = lambda proc=proc: proc.to_bytes(vocab=False) return util.to_bytes(serializers, {}) def from_bytes(self, bytes_data, disable=[]): @@ -459,8 +459,8 @@ class Language(object): continue if not hasattr(proc, 'from_bytes'): continue - deserializers[i] = lambda b: proc.from_bytes(b, vocab=False) - util.from_bytes(bytes_data, deserializers, {}) + deserializers[i] = lambda b, proc=proc: proc.from_bytes(b, vocab=False) + msg = util.from_bytes(bytes_data, deserializers, {}) return self