Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r88008:3e5d31c2b04e
Date: 2016-11-01 08:59 +0000
http://bitbucket.org/pypy/pypy/changeset/3e5d31c2b04e/

Log:    Add @unwrap_spec, fixes a translation error too

diff --git a/pypy/module/struct/interp_struct.py 
b/pypy/module/struct/interp_struct.py
--- a/pypy/module/struct/interp_struct.py
+++ b/pypy/module/struct/interp_struct.py
@@ -128,19 +128,6 @@
         self.index += size
         return w_res
 
-def new_unpackiter(space, w_subtype, w_struct, w_buffer):
-    buf = space.buffer_w(w_buffer, space.BUF_SIMPLE)
-    w_res = space.allocate_instance(W_UnpackIter, w_subtype)
-    w_res.__init__(w_struct, buf)
-    return w_res
-
-W_UnpackIter.typedef = TypeDef("unpack_iterator",
-    __new__=interp2app(new_unpackiter),
-    __iter__=interp2app(W_UnpackIter.descr_iter),
-    __next__=interp2app(W_UnpackIter.descr_next),
-    #__length_hint__=
-)
-
 
 class W_Struct(W_Root):
     _immutable_fields_ = ["format", "size"]
@@ -185,5 +172,19 @@
     iter_unpack=interp2app(W_Struct.descr_iter_unpack),
 )
 
+@unwrap_spec(w_struct=W_Struct)
+def new_unpackiter(space, w_subtype, w_struct, w_buffer):
+    buf = space.buffer_w(w_buffer, space.BUF_SIMPLE)
+    w_res = space.allocate_instance(W_UnpackIter, w_subtype)
+    w_res.__init__(w_struct, buf)
+    return w_res
+
+W_UnpackIter.typedef = TypeDef("unpack_iterator",
+    __new__=interp2app(new_unpackiter),
+    __iter__=interp2app(W_UnpackIter.descr_iter),
+    __next__=interp2app(W_UnpackIter.descr_next),
+    #__length_hint__=
+)
+
 def clearcache(space):
     """No-op on PyPy"""
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to