mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Simplify and remove few dependencies on 'errno', thanks to PEP 3151.
This commit is contained in:
parent
908ae24b06
commit
68f71a34f4
5 changed files with 28 additions and 45 deletions
|
@ -7,7 +7,7 @@ work. One should use importlib as the public-facing version of this module.
|
|||
|
||||
"""
|
||||
|
||||
# Injected modules are '_warnings', 'imp', 'sys', 'marshal', 'errno', '_io',
|
||||
# Injected modules are '_warnings', 'imp', 'sys', 'marshal', '_io',
|
||||
# and '_os' (a.k.a. 'posix', 'nt' or 'os2').
|
||||
# Injected attribute is path_sep.
|
||||
#
|
||||
|
@ -503,19 +503,13 @@ class _SourceFileLoader(_FileLoader, SourceLoader):
|
|||
parent = _path_join(parent, part)
|
||||
try:
|
||||
_os.mkdir(parent)
|
||||
except OSError as exc:
|
||||
except FileExistsError:
|
||||
# Probably another Python process already created the dir.
|
||||
if exc.errno == errno.EEXIST:
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
except IOError as exc:
|
||||
continue
|
||||
except PermissionError:
|
||||
# If can't get proper access, then just forget about writing
|
||||
# the data.
|
||||
if exc.errno == errno.EACCES:
|
||||
return
|
||||
else:
|
||||
raise
|
||||
return
|
||||
try:
|
||||
_write_atomic(path, data)
|
||||
except (PermissionError, FileExistsError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue