summaryrefslogtreecommitdiffstats
path: root/Lib/hotshot
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-10-13 02:55:40 (GMT)
committerFred Drake <fdrake@acm.org>2001-10-13 02:55:40 (GMT)
commitd62f151a2c0b821bd43dbc1301706cf3619c5bcd (patch)
tree9f7b4fe70317fc66aab50deb0b5a9c2d9133b60f /Lib/hotshot
parent5ae95abbc037343a24a97fcc74464fa0a70ba093 (diff)
downloadcpython-d62f151a2c0b821bd43dbc1301706cf3619c5bcd.zip
cpython-d62f151a2c0b821bd43dbc1301706cf3619c5bcd.tar.gz
cpython-d62f151a2c0b821bd43dbc1301706cf3619c5bcd.tar.bz2
When we reach the end of the log file, close the logreader object.
Diffstat (limited to 'Lib/hotshot')
-rw-r--r--Lib/hotshot/log.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/hotshot/log.py b/Lib/hotshot/log.py
index cd85353..39c4534 100644
--- a/Lib/hotshot/log.py
+++ b/Lib/hotshot/log.py
@@ -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