summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2021-10-29 13:40:37 (GMT)
committerGitHub <noreply@github.com>2021-10-29 13:40:37 (GMT)
commit8a77f59de51f1fd6062f0fefe73ee3059d714144 (patch)
treeb8fd711446dbd7a34c62588df1b197b6d05973d6 /Lib/logging
parent7bddd96982072d04bd6314da1ee7f40b7f875f00 (diff)
downloadcpython-8a77f59de51f1fd6062f0fefe73ee3059d714144.zip
cpython-8a77f59de51f1fd6062f0fefe73ee3059d714144.tar.gz
cpython-8a77f59de51f1fd6062f0fefe73ee3059d714144.tar.bz2
bpo-45628: Check all parts of the suffix for an extension match. (GH-29310)
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index b613bec..d42c48d 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -371,8 +371,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
for fileName in fileNames:
if fileName[:plen] == prefix:
suffix = fileName[plen:]
- if self.extMatch.match(suffix):
- result.append(os.path.join(dirName, fileName))
+ # See bpo-45628: The date/time suffix could be anywhere in the
+ # filename
+ parts = suffix.split('.')
+ for part in parts:
+ if self.extMatch.match(part):
+ result.append(os.path.join(dirName, fileName))
+ break
if len(result) < self.backupCount:
result = []
else: