Skip to content

Commit 191a939

Browse files
[3.10] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29314)
1 parent 6742b0d commit 191a939

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
@@ -371,8 +371,13 @@ def getFilesToDelete(self):
371371
for fileName in fileNames:
372372
if fileName[:plen] == prefix:
373373
suffix = fileName[plen:]
374-
if self.extMatch.match(suffix):
375-
result.append(os.path.join(dirName, fileName))
374+
# See bpo-45628: The date/time suffix could be anywhere in the
375+
# filename
376+
parts = suffix.split('.')
377+
for part in parts:
378+
if self.extMatch.match(part):
379+
result.append(os.path.join(dirName, fileName))
380+
break
376381
if len(result) < self.backupCount:
377382
result = []
378383
else:

0 commit comments

Comments
 (0)