Author: Richard Plangger <planri...@gmail.com>
Branch: py3.5-ssl
Changeset: r88818:fb36dd2e7878
Date: 2016-12-02 12:43 +0100
http://bitbucket.org/pypy/pypy/changeset/fb36dd2e7878/

Log:    check if end has reached when UnpackFormatIterator walks in backward
        direction

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
@@ -127,12 +127,11 @@
         self.pos = (self.pos + mask) & ~mask
 
     def finished(self):
-        if self.strides:
-            # FIXME richard
-            pass
-        else:
-            if self.pos != self.length:
-                raise StructError("unpack str size too long for format")
+        value = self.pos
+        if self.strides and self.strides[0] < 0:
+                value = -self.pos
+        if value != self.length:
+            raise StructError("unpack str size too long for format")
 
     def read(self, count):
         if self.strides:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to