chunkers: remove dead fill() error-return handling

fill() is declared 'except 0' and always returns 1: errors propagate as
exceptions, so the 'if not self.fill(): return None' branches were
unreachable (and process() returning None would have crashed __next__
anyway). Call fill() plainly instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Thomas Waldmann 2026-07-01 23:03:25 +02:00
parent f6b79761a2
commit 0b7ec02b2f
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
3 changed files with 6 additions and 12 deletions

View file

@ -232,8 +232,7 @@ cdef class Chunker:
raise Exception("chunkifier byte count mismatch")
while self.remaining < min_size + window_size + 1 and not self.eof: # see assert in Chunker init
if not self.fill():
return None
self.fill()
# Here we either are at eof...
if self.eof:
@ -268,8 +267,7 @@ cdef class Chunker:
self.remaining -= did_bytes
if self.remaining <= window_size:
if not self.fill():
return None
self.fill()
if self.remaining <= window_size:
self.position += self.remaining

View file

@ -237,8 +237,7 @@ cdef class ChunkerBuzHash64:
raise Exception("chunkifier byte count mismatch")
while self.remaining < min_size + window_size + 1 and not self.eof: # see assert in Chunker init
if not self.fill():
return None
self.fill()
# Here we either are at eof...
if self.eof:
@ -294,8 +293,7 @@ cdef class ChunkerBuzHash64:
self.remaining -= did_bytes
if self.remaining <= window_size:
if not self.fill():
return None
self.fill()
if self.remaining <= window_size:
self.position += self.remaining

View file

@ -175,8 +175,7 @@ cdef class ChunkerFastCDC:
# ensure at least min_size + 1 bytes are buffered, or we are at eof
while self.remaining < min_size + 1 and not self.eof:
if not self.fill():
return None
self.fill()
# at eof with only a remainder (< min_size + 1): emit it as the final chunk
if self.eof and self.remaining < min_size + 1:
@ -207,8 +206,7 @@ cdef class ChunkerFastCDC:
if self.remaining == 0:
if self.eof:
break # cut at end of data
if not self.fill():
return None
self.fill()
if self.remaining == 0:
break # buffer full -> chunk reached max_size -> forced cut
continue