summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
commit0166a283f65b08ee2dddb1b075f86862b8c7e3e4 (patch)
treef319f122b4865fcba24d86fd4d48f3f923cfea8b /Lib/logging
parentb071d4f3da8db02dc5b355590f1f909896592ec3 (diff)
downloadcpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.zip
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.gz
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.bz2
modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 1491b47..263acc9 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -438,11 +438,8 @@ class WatchedFileHandler(logging.FileHandler):
try:
# stat the file by path, checking for existence
sres = os.stat(self.baseFilename)
- except OSError as err:
- if err.errno == errno.ENOENT:
- sres = None
- else:
- raise
+ except FileNotFoundError:
+ sres = None
# compare file system stat with that of our stream file handle
if not sres or sres[ST_DEV] != self.dev or sres[ST_INO] != self.ino:
if self.stream is not None: