diff options
author | Lovesh Harchandani <lovesh@users.noreply.github.com> | 2017-10-27 09:04:33 +0200 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-10-27 08:04:33 +0100 |
commit | afad147b59fe84b12317f7340ddd2deeecb22321 (patch) | |
tree | c8baf4e9a25c1417c6253b081ae22880b896faf6 /Lib/logging | |
parent | bpo-31053: Remove redundant 'venv' argument in venv example (GH-2907) (diff) | |
download | cpython-afad147b59fe84b12317f7340ddd2deeecb22321.tar.gz cpython-afad147b59fe84b12317f7340ddd2deeecb22321.tar.bz2 cpython-afad147b59fe84b12317f7340ddd2deeecb22321.zip |
bpo-30989: Sort in TimedRotatingFileHandler only when needed. (GH-2812)
TimedRotatingFileHandler.getFilesToDelete() now sorts only when needed.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/handlers.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index a815f033e60..d1871acfa4b 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -353,10 +353,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler): suffix = fileName[plen:] if self.extMatch.match(suffix): result.append(os.path.join(dirName, fileName)) - result.sort() if len(result) < self.backupCount: result = [] else: + result.sort() result = result[:len(result) - self.backupCount] return result |