mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)
This commit is contained in:
parent
b071d4f3da
commit
0166a283f6
6 changed files with 27 additions and 51 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue