mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #10949: Improved robustness of rotating file handlers.
This commit is contained in:
parent
00d650baaa
commit
01241d6c35
2 changed files with 4 additions and 0 deletions
|
@ -120,6 +120,7 @@ class RotatingFileHandler(BaseRotatingHandler):
|
|||
"""
|
||||
if self.stream:
|
||||
self.stream.close()
|
||||
self.stream = None
|
||||
if self.backupCount > 0:
|
||||
for i in range(self.backupCount - 1, 0, -1):
|
||||
sfn = "%s.%d" % (self.baseFilename, i)
|
||||
|
@ -316,6 +317,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
|||
"""
|
||||
if self.stream:
|
||||
self.stream.close()
|
||||
self.stream = None
|
||||
# get the time that this sequence started at and make it a TimeTuple
|
||||
t = self.rolloverAt - self.interval
|
||||
if self.utc:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue