Author: Justin Peel <[email protected]>
Branch: unpack-ints-fast
Changeset: r46850:d18372b66c65
Date: 2011-08-28 00:27 -0600
http://bitbucket.org/pypy/pypy/changeset/d18372b66c65/
Log: fixed rzipfile problems, I think
diff --git a/pypy/module/struct/formatiterator.py
b/pypy/module/struct/formatiterator.py
--- a/pypy/module/struct/formatiterator.py
+++ b/pypy/module/struct/formatiterator.py
@@ -161,6 +161,9 @@
raise StructError("unpack str size too short for format")
return pos
+ def get_input(self):
+ return self.input
+
def appendobj(self, value):
self.result_w.append(self.space.wrap(value))
appendobj._annspecialcase_ = 'specialize:argtype(1)'
diff --git a/pypy/rlib/rstruct/runpack.py b/pypy/rlib/rstruct/runpack.py
--- a/pypy/rlib/rstruct/runpack.py
+++ b/pypy/rlib/rstruct/runpack.py
@@ -23,6 +23,13 @@
self.inputpos = end
return s
+ def get_pos_and_advance(self, count):
+ pos = self.inputpos
+ self.inputpos += count
+ if self.inputpos > len(self.input):
+ raise StructError("unpack str size too short for format")
+ return pos
+
def align(self, mask):
self.inputpos = (self.inputpos + mask) & ~mask
@@ -38,6 +45,12 @@
def read(self, count):
return self.mr.read(count)
+ def get_input(self):
+ return self.mr.input
+
+ def get_pos_and_advance(self, count):
+ return self.mr.get_pos_and_advance(count)
+
def appendobj(self, value):
self.value = value
ReaderForPos.__name__ = 'ReaderForPos%d' % pos
@@ -47,7 +60,7 @@
def __init__(self, fmt):
self.formats = []
self.fmt = fmt
-
+
def operate(self, fmtdesc, repetitions):
if fmtdesc.needcount:
self.formats.append((fmtdesc, repetitions, None))
@@ -111,5 +124,3 @@
unpacker = create_unpacker(fmt)
return unpacker.unpack(input)
runpack._annspecialcase_ = 'specialize:arg(0)'
-
-
diff --git a/pypy/rlib/rstruct/standardfmttable.py
b/pypy/rlib/rstruct/standardfmttable.py
--- a/pypy/rlib/rstruct/standardfmttable.py
+++ b/pypy/rlib/rstruct/standardfmttable.py
@@ -198,7 +198,7 @@
@specialize.argtype(0)
def unpack_int(fmtiter):
intvalue = inttype(0)
- s = fmtiter.input
+ s = fmtiter.get_input()
idx = fmtiter.get_pos_and_advance(size)
if fmtiter.bigendian:
for i in unroll_range_size:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit