diff --git a/Lib/hotshot/log.py b/Lib/hotshot/log.py index 335fff90fff..9084461c290 100644 --- a/Lib/hotshot/log.py +++ b/Lib/hotshot/log.py @@ -51,6 +51,9 @@ def __init__(self, logfn): self._append = self._stack.append self._pop = self._stack.pop + def close(self): + self._reader.close() + def addinfo(self, key, value): """This method is called for each additional ADD_INFO record. diff --git a/Lib/test/test_hotshot.py b/Lib/test/test_hotshot.py index db3c914b5bf..2a45a7f527c 100644 --- a/Lib/test/test_hotshot.py +++ b/Lib/test/test_hotshot.py @@ -31,10 +31,7 @@ def next(self, index=None): try: return hotshot.log.LogReader.next(self) except (IndexError, StopIteration): - # XXX This fails on Windows because the named file is still - # XXX open. Offhand I couldn't find an appropriate way to close - # XXX the file object, or even where the heck it is. LogReader - # XXX in particular doesn't have a close() method. + self.close() os.unlink(self.__logfn) raise