From 6252a72965e7fa4c23e5d9fe62f60f91cee2fc14 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Tue, 28 Jul 2015 13:01:15 -0700
Subject: [PATCH] IReadable.read(): document out-of-range errors

closes ticket#2461
---
 src/allmydata/interfaces.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index ded8ffb2..e495c759 100644
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -665,7 +665,10 @@ class IReadable(Interface):
         the last byte has been given to it, or because the consumer threw an
         exception during write(), possibly because it no longer wants to
         receive data). The portion downloaded will start at 'offset' and
-        contain 'size' bytes (or the remainder of the file if size==None).
+        contain 'size' bytes (or the remainder of the file if size==None). It
+        is an error to read beyond the end of the file: callers must use
+        get_size() and clip any non-default offset= and size= parameters. It
+        is permissible to read zero bytes.
 
         The consumer will be used in non-streaming mode: an IPullProducer
         will be attached to it.
-- 
2.45.2