When we reach the end of the log file, close the logreader object.

This commit is contained in:
Fred Drake 2001-10-13 02:55:40 +00:00
parent 5ae95abbc0
commit d62f151a2c
1 changed files with 3 additions and 1 deletions

View File

@ -34,7 +34,8 @@ class LogReader:
self._funcmap = {}
self._info = {}
self._nextitem = _hotshot.logreader(logfn).next
self._reader = _hotshot.logreader(logfn)
self._nextitem = self._reader.next
self._stack = []
# Iteration support:
@ -47,6 +48,7 @@ class LogReader:
what, tdelta, fileno, lineno = self._nextitem()
except TypeError:
# logreader().next() returns None at the end
self._reader.close()
raise StopIteration()
if what == WHAT_DEFINE_FILE:
self._filemap[fileno] = tdelta