explosion/spaCy

Spacy fails to deserialize empty document from binary format

bdaskalov opened this issue · 2 comments

Spacy throws the following exception when deserializaing an empty document from binary format:


SystemError Traceback (most recent call last)
in ()
5 b = empty_doc.to_bytes()
6 d = Doc(english.vocab)
----> 7 d.from_bytes(b)

/home/boris/work/happ/customers/ubs/venv/lib/python3.5/site-packages/spacy/tokens/doc.pyx in spacy.tokens.doc.Doc.from_bytes (spacy/tokens/doc.cpp:10859)()

SystemError: <built-in method unpack_into of spacy.serialize.packer.Packer object at 0x7f0ea30af638> returned NULL without setting an error

Can be reproduced on spacy 0.101.0 using the following code:

import spacy
from spacy.tokens import Doc
english = spacy.en.English()
empty_doc = english("")
b = empty_doc.to_bytes()
d = Doc(english.vocab)
d.from_bytes(b)

Fixed, thanks!

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.