summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/logging/handlers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 93aa50e..f0f634e 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -111,7 +111,9 @@ class BaseRotatingHandler(logging.FileHandler):
what the source is rotated to, e.g. 'test.log.1'.
"""
if not callable(self.rotator):
- os.rename(source, dest)
+ # Issue 18940: A file may not have been created if delay is True.
+ if os.path.exists(source):
+ os.rename(source, dest)
else:
self.rotator(source, dest)