summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-16 07:46:38 (GMT)
committerGitHub <noreply@github.com>2017-04-16 07:46:38 (GMT)
commit55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0 (patch)
treec1b3aacf87240d393666321d49a5abde3e1d601f /Lib/importlib
parentfdbd01151dbd5feea3e4c0316d102db3d2a2a412 (diff)
downloadcpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.zip
cpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.tar.gz
cpython-55fe1ae9708d81b902b6fe8f6590e2a24b1bd4b0.tar.bz2
bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap_external.py8
-rw-r--r--Lib/importlib/abc.py6
2 files changed, 7 insertions, 7 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index ec528b2..3235404 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -689,9 +689,9 @@ class SourceLoader(_LoaderBasics):
"""Optional method that returns the modification time (an int) for the
specified path, where path is a str.
- Raises IOError when the path cannot be handled.
+ Raises OSError when the path cannot be handled.
"""
- raise IOError
+ raise OSError
def path_stats(self, path):
"""Optional method returning a metadata dict for the specified path
@@ -702,7 +702,7 @@ class SourceLoader(_LoaderBasics):
- 'size' (optional) is the size in bytes of the source code.
Implementing this method allows the loader to read bytecode files.
- Raises IOError when the path cannot be handled.
+ Raises OSError when the path cannot be handled.
"""
return {'mtime': self.path_mtime(path)}
@@ -757,7 +757,7 @@ class SourceLoader(_LoaderBasics):
else:
try:
st = self.path_stats(source_path)
- except IOError:
+ except OSError:
pass
else:
source_mtime = int(st['mtime'])
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index 661bd76..d7cadf2 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -193,7 +193,7 @@ class ResourceLoader(Loader):
def get_data(self, path):
"""Abstract method which when implemented should return the bytes for
the specified path. The path must be a str."""
- raise IOError
+ raise OSError
class InspectLoader(Loader):
@@ -315,7 +315,7 @@ class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLo
def path_mtime(self, path):
"""Return the (int) modification time for the path (str)."""
if self.path_stats.__func__ is SourceLoader.path_stats:
- raise IOError
+ raise OSError
return int(self.path_stats(path)['mtime'])
def path_stats(self, path):
@@ -326,7 +326,7 @@ class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLo
- 'size' (optional) is the size in bytes of the source code.
"""
if self.path_mtime.__func__ is SourceLoader.path_mtime:
- raise IOError
+ raise OSError
return {'mtime': self.path_mtime(path)}
def set_data(self, path, data):