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
However the leading if dcompdat and means that the condition doesn't apply if zero bytes were read. Removing this part of the condition addresses the issue (but I understand from the comment that this is in order to support compressed_bytes_read()).
I have code that relies on reading an object from a gitdb stream.
To do this I used with a standard
.read()loop (like with io.RawIOBase):The behaviour I expected to see (from the duck-type with RawIOBase) is to only see
b''at EOF:However
stream.read(4096)can return empty chunks even before the end of the stream, so the loop exits early.For the file where I saw this first, it is sensitive to the
sizeparameter - it apparently occurs for0 < size <= 4096.Looking at the code there is a condition to repeat a read if we got insufficient bytes:
gitdb/gitdb/stream.py
Lines 316 to 317 in f36c0cc
However the leading
if dcompdat andmeans that the condition doesn't apply if zero bytes were read. Removing this part of the condition addresses the issue (but I understand from the comment that this is in order to supportcompressed_bytes_read()).