[Python-checkins] bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475) (GH-27486)

vsajip webhook-mailer at python.org
Fri Jul 30 12:20:33 EDT 2021


https://github.com/python/cpython/commit/882e4761c63ae76d994b57bbcd7e5adbf2aa7b4f
commit: 882e4761c63ae76d994b57bbcd7e5adbf2aa7b4f
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: vsajip <vinay_sajip at yahoo.co.uk>
date: 2021-07-30T17:20:24+01:00
summary:

bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475) (GH-27486)

(cherry picked from commit 6ff890380971752299325bd28eab80ec936975cf)

files:
M Lib/logging/handlers.py

diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 867ef4ebc7600a..74b67602fa94fe 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -356,7 +356,8 @@ def getFilesToDelete(self):
         dirName, baseName = os.path.split(self.baseFilename)
         fileNames = os.listdir(dirName)
         result = []
-        prefix = baseName + "."
+        # See bpo-44753: Don't use the extension when computing the prefix.
+        prefix = os.path.splitext(baseName)[0] + "."
         plen = len(prefix)
         for fileName in fileNames:
             if fileName[:plen] == prefix:



More information about the Python-checkins mailing list