diff --git a/src/python/libsmbios_c/smbios_token.py b/src/python/libsmbios_c/smbios_token.py index c15c2deb..cc5f77ed 100644 --- a/src/python/libsmbios_c/smbios_token.py +++ b/src/python/libsmbios_c/smbios_token.py @@ -125,13 +125,16 @@ def __del__(self): @traceLog() def __iter__(self): - cur = ctypes.POINTER(Token)() - while 1: - cur =DLL.token_table_get_next( self._tableobj, cur ) - if bool(cur): - yield cur.contents - else: - raise StopIteration + self._cur = ctypes.POINTER(Token)() + return self + + @traceLog() + def __next__(self): + self._cur =DLL.token_table_get_next( self._tableobj, self._cur ) + if bool(self._cur): + return self._cur.contents + else: + raise StopIteration @traceLog() def __getitem__(self, id):