diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-10-29 08:24:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 16:24:41 +0100 |
commit | 317e0c99e3804310f4bee23e497d9d84b717d7f7 (patch) | |
tree | 67a62cfde03189651549ad36c32cad844cc70f7a | |
parent | [3.9] [3.10] bpo-45502: Fix test_shelve (GH-29003) (GH-29305) (GH-29306) (diff) | |
download | cpython-317e0c99e3804310f4bee23e497d9d84b717d7f7.tar.gz cpython-317e0c99e3804310f4bee23e497d9d84b717d7f7.tar.bz2 cpython-317e0c99e3804310f4bee23e497d9d84b717d7f7.zip |
[3.9] bpo-45628: Check all parts of the suffix for an extension match. (GH-29310) (GH-29313)
-rw-r--r-- | Lib/logging/handlers.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 7f1f10551c3..f8040c498c1 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -368,8 +368,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler): 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: |