]> granicus.if.org Git - python/commitdiff
Fixed the negative value check in io._BytesIO.seek().
authorAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 8 May 2008 01:39:38 +0000 (01:39 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 8 May 2008 01:39:38 +0000 (01:39 +0000)
Lib/io.py

index 940c4c776c806d1ad967c41cdaf083aafb94b40c..d85ed49d150f32af884a45162f2e06031efeabd0 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -831,9 +831,9 @@ class _BytesIO(BufferedIOBase):
         except AttributeError as err:
             raise TypeError("an integer is required") from err
         if whence == 0:
-            self._pos = max(0, pos)
             if pos < 0:
                 raise ValueError("negative seek position %r" % (pos,))
+            self._pos = max(0, pos)
         elif whence == 1:
             self._pos = max(0, self._pos + pos)
         elif whence == 2: