]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44753: Don't use logfile extension when determining old files to be deleted ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 30 Jul 2021 16:20:59 +0000 (09:20 -0700)
committerGitHub <noreply@github.com>
Fri, 30 Jul 2021 16:20:59 +0000 (17:20 +0100)
(cherry picked from commit 6ff890380971752299325bd28eab80ec936975cf)

Lib/logging/handlers.py

index 2a45f5379b1e34fafb115a207029cbfdd60f4553..4cabc0d740c29f5d8a6213a42a0ead9c745c2b0f 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: