summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 09:10:22 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 09:10:22 (GMT)
commitd859926b298516402a1e8b963cf62e568f0eb848 (patch)
tree4871178dd74df357d1fb01b10ed95f83e34f0ae7 /Lib
parenta704582002ac621080cdbbfbe46eb7faf3393313 (diff)
downloadcpython-d859926b298516402a1e8b963cf62e568f0eb848.zip
cpython-d859926b298516402a1e8b963cf62e568f0eb848.tar.gz
cpython-d859926b298516402a1e8b963cf62e568f0eb848.tar.bz2
Issue #18940: Handled low-volume logging when delay is True.
Diffstat (limited to 'Lib')
-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)