[Python-checkins] [3.10] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29314)

vsajip webhook-mailer at python.org
Fri Oct 29 11:25:36 EDT 2021


https://github.com/python/cpython/commit/191a93905a84f272b2232701dc5dcc69987330f5
commit: 191a93905a84f272b2232701dc5dcc69987330f5
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: vsajip <vinay_sajip at yahoo.co.uk>
date: 2021-10-29T16:25:31+01:00
summary:

[3.10] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29314)

files:
M Lib/logging/handlers.py

diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 4dcbe4530fcfc..4e8f0a8cc2f46 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -371,8 +371,13 @@ def getFilesToDelete(self):
         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:



More information about the Python-checkins mailing list