]> granicus.if.org Git - python/commitdiff
Fix error handling in new fast path of BZ2File.readline().
authorNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 1 Oct 2012 21:04:11 +0000 (23:04 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Mon, 1 Oct 2012 21:04:11 +0000 (23:04 +0200)
Lib/bz2.py

index 87bed214d0a7bd500a2e1d51fc4230a3b3c6072c..da19e272334cc7a371df12e03a1c8e140d9f90e3 100644 (file)
@@ -323,6 +323,7 @@ class BZ2File(io.BufferedIOBase):
             raise TypeError("Integer argument expected")
         size = size.__index__()
         with self._lock:
+            self._check_can_read()
             # Shortcut for the common case - the whole line is in the buffer.
             if size < 0:
                 end = self._buffer.find(b"\n", self._buffer_offset) + 1