From 081d27a65d02e82578799c7d2e2979d4a0e02afc Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 24 Jan 2008 21:51:09 -0700 Subject: [PATCH] encode.py: improve error message when segment lengths come out wrong --- src/allmydata/encode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/allmydata/encode.py b/src/allmydata/encode.py index 1615b00f..0815df93 100644 --- a/src/allmydata/encode.py +++ b/src/allmydata/encode.py @@ -352,7 +352,11 @@ class Encoder(object): encrypted_pieces.append('\x00' * pad_size) else: # non-tail segments should be the full segment size - assert length == input_chunk_size + log.msg("non-tail segment should be full segment size: %d!=%d" + % (length, input_chunk_size), level=log.BAD) + precondition(length == input_chunk_size, + "length=%d != input_chunk_size=%d" % + (length, input_chunk_size)) encrypted_piece = "".join(encrypted_pieces) return previous_chunks + [encrypted_piece] -- 2.45.2