* Fix open-bounded slice indices.

This commit is contained in:
Matthew Honnibal 2015-09-29 23:03:09 +10:00
parent e562f504ee
commit ab694b0364

View File

@ -91,9 +91,9 @@ cdef class Doc:
raise ValueError("Stepped slices not supported in Span objects." raise ValueError("Stepped slices not supported in Span objects."
"Try: list(doc)[start:stop:step] instead.") "Try: list(doc)[start:stop:step] instead.")
if i.start is None: if i.start is None:
i.start = 0 i = slice(0, i.stop)
if i.stop is None: if i.stop is None:
i.stop = len(self) i = slice(i.start, len(self))
return Span(self, i.start, i.stop, label=0) return Span(self, i.start, i.stop, label=0)
if i < 0: if i < 0: