summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2011-10-28 14:06:23 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2011-10-28 14:06:23 (GMT)
commit68f71a34f4a799276a50f4001fb0a0ebe2d46992 (patch)
tree5b7a409891bb7d4a1c1750b9f97b13a7d1e392e2 /Lib/importlib
parent908ae24b066b04651701d5ee5e5d80cfb5d6b018 (diff)
downloadcpython-68f71a34f4a799276a50f4001fb0a0ebe2d46992.zip
cpython-68f71a34f4a799276a50f4001fb0a0ebe2d46992.tar.gz
cpython-68f71a34f4a799276a50f4001fb0a0ebe2d46992.tar.bz2
Simplify and remove few dependencies on 'errno', thanks to PEP 3151.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/__init__.py3
-rw-r--r--Lib/importlib/_bootstrap.py16
2 files changed, 6 insertions, 13 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py
index 2baaf93..9b20367 100644
--- a/Lib/importlib/__init__.py
+++ b/Lib/importlib/__init__.py
@@ -81,11 +81,10 @@ except ImportError:
except ImportError:
raise ImportError('posix, nt, or os2 module required for importlib')
_bootstrap._os = _os
-import imp, sys, marshal, errno, _io
+import imp, sys, marshal, _io
_bootstrap.imp = imp
_bootstrap.sys = sys
_bootstrap.marshal = marshal
-_bootstrap.errno = errno
_bootstrap._io = _io
import _warnings
_bootstrap._warnings = _warnings
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 1e22438..4161b3e 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -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):