You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since by default Python3.5 uses a buffer reader, it should have the same functionality as nltk.data.BufferedGzipFile. Assuming that the core Python team don't backport this functionality, we should consider deprecating this when we start dropping python2.7 support.
Meanwhile I think the easiest fix is to refactor BufferedGzipFile._buffer to do something like BufferedGzipFile._nltk_buffer. And that should resolve Python3.4 -> 3.5 related issues for now =)
The text was updated successfully, but these errors were encountered:
On the CI tests for Python 3.5,
BufferedGzipFile
test is breaking at https://github.com/nltk/nltk/blob/develop/nltk/test/data.doctest#L327This is because of the change in how buffer is read when code was modified from Python3.4 -> 3.5:
There's a new
GzipFile._buffer
variable in Python3.5 that clashes withnltk.data.BufferedGzipFile._buffer
, so at https://github.com/nltk/nltk/blob/develop/nltk/data.py#L372 ,nltk.data.BufferedGzipFile
, it uses thegzip.GzipFile.__init__
that sets the._buffer
variable to the file objectnltk.data.BufferedGzipFile
setsself._buffer = BytesIO()
, the super-class' buffer was overwritten and unloaded the file object within theself._buffer
and it reads an empty file causingtest.read()
in the doctest to be None.Since by default Python3.5 uses a buffer reader, it should have the same functionality as
nltk.data.BufferedGzipFile
. Assuming that the core Python team don't backport this functionality, we should consider deprecating this when we start droppingpython2.7
support.Meanwhile I think the easiest fix is to refactor
BufferedGzipFile._buffer
to do something likeBufferedGzipFile._nltk_buffer
. And that should resolve Python3.4 -> 3.5 related issues for now =)The text was updated successfully, but these errors were encountered: