Skip to content

Commit 317e0c9

Browse files
[3.9] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29313)
1 parent a043706 commit 317e0c9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Lib/logging/handlers.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,13 @@ def getFilesToDelete(self):
368368
for fileName in fileNames:
369369
if fileName[:plen] == prefix:
370370
suffix = fileName[plen:]
371-
if self.extMatch.match(suffix):
372-
result.append(os.path.join(dirName, fileName))
371+
# See bpo-45628: The date/time suffix could be anywhere in the
372+
# filename
373+
parts = suffix.split('.')
374+
for part in parts:
375+
if self.extMatch.match(part):
376+
result.append(os.path.join(dirName, fileName))
377+
break
373378
if len(result) < self.backupCount:
374379
result = []
375380
else:

0 commit comments

Comments
 (0)