1. Armin Rigo
  2. cpython-withatomic

Commits

Alexandre Vassalotti  committed e3459ad

Fixed the negative value check in io._BytesIO.seek().

  • Participants
  • Parent commits 831a30c
  • Branches default

Comments (0)

Files changed (1)

File Lib/io.py

View file
         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: