mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)
This commit is contained in:
parent
fdbd01151d
commit
55fe1ae970
36 changed files with 1538 additions and 1538 deletions
|
@ -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'])
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue