[pypy-commit] pypy release-2.3.x: Translation fix for 3777204fff8e
arigo
noreply at buildbot.pypy.org
Tue May 20 18:21:29 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: release-2.3.x
Changeset: r71609:d2dda83f486d
Date: 2014-05-19 10:27 +0200
http://bitbucket.org/pypy/pypy/changeset/d2dda83f486d/
Log: Translation fix for 3777204fff8e
diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -209,11 +209,13 @@
while size > 0:
# "peeks" on the underlying stream to see how many chars
# we can safely read without reading past an end-of-line
- peeked = stream.peek()
- pn = peeked.find("\n", 0, size)
+ startindex, peeked = stream.peek()
+ assert 0 <= startindex <= len(peeked)
+ endindex = startindex + size
+ pn = peeked.find("\n", startindex, endindex)
if pn < 0:
- pn = min(size-1, len(peeked))
- c = stream.read(pn + 1)
+ pn = min(endindex - 1, len(peeked))
+ c = stream.read(pn - startindex + 1)
if not c:
break
result.append(c)
diff --git a/rpython/rlib/streamio.py b/rpython/rlib/streamio.py
--- a/rpython/rlib/streamio.py
+++ b/rpython/rlib/streamio.py
@@ -554,7 +554,7 @@
else:
difpos = offset
if -self.pos <= difpos <= currentsize:
- self.pos += difpos
+ self.pos += intmask(difpos)
return
if whence == 1:
offset -= currentsize
More information about the pypy-commit
mailing list