Open ChristofKaufmann opened 2 days ago
Good catch, and sorry for introducing the bug.
I don't want us to add zstandard
as a dependency, even for testing, so I created a very lightweight mock class that provides a non-seekable byte stream, and added it to the tests I'd want to see.
Subsequent read operations against the non-seekable bytes (also for the zstandard stream) will fail, but I'm assuming that is well expected for this use case.
Since 0.8.0 reading a zstandard compressed file does not work anymore. The following code works in 0.7.2, but not in 0.8.0 and 0.9.0:
The last test results in the stack trace:
A zstd decompression stream can be seeked only forwards, but not backwards. Hence its seekable method returns
False
. The issue has been introduced in #397.This PR fixes it. Instead of only checking, whether the
seek
method exists, this PR checks whether theseekable
method exists and returnsTrue
. Only thenseek(0)
is used.Do you want me to add any test cases for this? If so, based on
zstandard
?