]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44753: Don't use logfile extension when determining old files to be deleted ...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 30 Jul 2021 11:48:50 +0000 (12:48 +0100)
committerGitHub <noreply@github.com>
Fri, 30 Jul 2021 11:48:50 +0000 (12:48 +0100)
Lib/logging/handlers.py

index 9506b9acdd4fa343ac93e4085a6875ed9932fffb..e2579db58046df32f648ed7a0f6dd9aeeb5a8a15 100644 (file)
@@ -359,7 +359,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
         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: