8000 python: Remove UnpackIterator. Unpacker is iterator of itself. · urso/msgpack-python@af7113b · GitHub
[go: up one dir, main page]

Skip to content

Commit af7113b

Browse files
committed
python: Remove UnpackIterator. Unpacker is iterator of itself.
1 parent 60d3ce3 commit af7113b

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

msgpack/_msgpack.pyx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,6 @@ def unpack(object stream, object object_hook=None, object list_hook=None, bint u
205205
return unpackb(stream.read(), use_list=use_list,
206206
object_hook=object_hook, list_hook=list_hook)
207207

208-
cdef class UnpackIterator(object):
209-
cdef object unpacker
210-
211-
def __init__(self, unpacker):
212-
self.unpacker = unpacker
213-
214-
def __next__(self):
215-
return self.unpacker.unpack()
216-
217-
def __iter__(self):
218-
return self
219-
220208
cdef class Unpacker(object):
221209
"""Unpacker(read_size=1024*1024)
222210
@@ -347,7 +335,10 @@ cdef class Unpacker(object):
347335
raise ValueError("Unpack failed: error = %d" % (ret,))
348336

349337
def __iter__(self):
350-
return UnpackIterator(self)
338+
return self
339+
340+
def __next__(self):
341+
return self.unpack()
351342

352343
# for debug.
353344
#def _buf(self):

0 commit comments

Comments
 (0)
0