Commit eb9d5ad6 authored by Vinay Sajip's avatar Vinay Sajip

Issue #10949: Improved robustness of rotating file handlers.

parent a970e622
...@@ -114,6 +114,7 @@ class RotatingFileHandler(BaseRotatingHandler): ...@@ -114,6 +114,7 @@ class RotatingFileHandler(BaseRotatingHandler):
""" """
if self.stream: if self.stream:
self.stream.close() self.stream.close()
self.stream = None
if self.backupCount > 0: if self.backupCount > 0:
for i in range(self.backupCount - 1, 0, -1): for i in range(self.backupCount - 1, 0, -1):
sfn = "%s.%d" % (self.baseFilename, i) sfn = "%s.%d" % (self.baseFilename, i)
...@@ -313,6 +314,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler): ...@@ -313,6 +314,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
""" """
if self.stream: if self.stream:
self.stream.close() self.stream.close()
self.stream = None
# get the time that this sequence started at and make it a TimeTuple # get the time that this sequence started at and make it a TimeTuple
t = self.rolloverAt - self.interval t = self.rolloverAt - self.interval
if self.utc: if self.utc:
......
...@@ -37,6 +37,8 @@ Core and Builtins ...@@ -37,6 +37,8 @@ Core and Builtins
Library Library
------- -------
- Issue #10949: Improved robustness of rotating file handlers.
- Issue #10955: Fix a potential crash when trying to mmap() a file past its - Issue #10955: Fix a potential crash when trying to mmap() a file past its
length. Initial patch by Ross Lagerwall. length. Initial patch by Ross Lagerwall.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment