mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -232,10 +232,9 @@ def makedirs(name, mode=0o777, exist_ok=False):
|
|||
if head and tail and not path.exists(head):
|
||||
try:
|
||||
makedirs(head, mode, exist_ok)
|
||||
except OSError as e:
|
||||
except FileExistsError:
|
||||
# be happy if someone already created the path
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
pass
|
||||
cdir = curdir
|
||||
if isinstance(tail, bytes):
|
||||
cdir = bytes(curdir, 'ASCII')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue