From 182624895f6a92319fc72f62c36474978bff2a04 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sun, 30 Jan 2011 10:45:39 +0900 Subject: [PATCH] python: Remove UnpackIterator. Unpacker is iterator of itself. --- python/msgpack/_msgpack.pyx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/python/msgpack/_msgpack.pyx b/python/msgpack/_msgpack.pyx index e367444c..cdcd0c81 100644 --- a/python/msgpack/_msgpack.pyx +++ b/python/msgpack/_msgpack.pyx @@ -205,18 +205,6 @@ def unpack(object stream, object object_hook=None, object list_hook=None, bint u return unpackb(stream.read(), use_list=use_list, object_hook=object_hook, list_hook=list_hook) -cdef class UnpackIterator(object): - cdef object unpacker - - def __init__(self, unpacker): - self.unpacker = unpacker - - def __next__(self): - return self.unpacker.unpack() - - def __iter__(self): - return self - cdef class Unpacker(object): """Unpacker(read_size=1024*1024) @@ -347,7 +335,10 @@ cdef class Unpacker(object): raise ValueError("Unpack failed: error = %d" % (ret,)) def __iter__(self): - return UnpackIterator(self) + return self + + def __next__(self): + return self.unpack() # for debug. #def _buf(self):