mirror of https://github.com/python/cpython
Removed buggy exception handling in doRollover of rotating file handlers. Exceptions now propagate to caller.
This commit is contained in:
parent
c315a0fa40
commit
6dd59f1632
|
@ -128,12 +128,7 @@ class RotatingFileHandler(BaseRotatingHandler):
|
|||
dfn = self.baseFilename + ".1"
|
||||
if os.path.exists(dfn):
|
||||
os.remove(dfn)
|
||||
try:
|
||||
os.rename(self.baseFilename, dfn)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except:
|
||||
self.handleError(record)
|
||||
os.rename(self.baseFilename, dfn)
|
||||
#print "%s -> %s" % (self.baseFilename, dfn)
|
||||
if self.encoding:
|
||||
self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
|
||||
|
@ -273,12 +268,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
|||
dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
|
||||
if os.path.exists(dfn):
|
||||
os.remove(dfn)
|
||||
try:
|
||||
os.rename(self.baseFilename, dfn)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except:
|
||||
self.handleError(record)
|
||||
os.rename(self.baseFilename, dfn)
|
||||
if self.backupCount > 0:
|
||||
# find the oldest log file and delete it
|
||||
s = glob.glob(self.baseFilename + ".20*")
|
||||
|
|
Loading…
Reference in New Issue