summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 09:11:37 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 09:11:37 (GMT)
commita92a3564a92834c354712229942f70e6e5620371 (patch)
tree940e066f6de28ed6b0c490ab8202d43e5d9e39b1
parente2549df82ed56bae920084684d916b602d9de691 (diff)
parentd859926b298516402a1e8b963cf62e568f0eb848 (diff)
downloadcpython-a92a3564a92834c354712229942f70e6e5620371.zip
cpython-a92a3564a92834c354712229942f70e6e5620371.tar.gz
cpython-a92a3564a92834c354712229942f70e6e5620371.tar.bz2
Closes #18940: Merged fix from 3.3.
-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 f1ddbb5..b67a8ac 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -109,7 +109,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)