diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-11-07 23:57:20 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-11-07 23:57:20 (GMT) |
commit | 3d26b95ca7ad0f2a39f39606acf2935eb4344e67 (patch) | |
tree | d1a50ef884caa7bbe5b804b67a805a00fc65f291 /Lib/importlib/_bootstrap.py | |
parent | 1fa0c3f5bf2349ffa231608f25de2912479d89bd (diff) | |
download | cpython-3d26b95ca7ad0f2a39f39606acf2935eb4344e67.zip cpython-3d26b95ca7ad0f2a39f39606acf2935eb4344e67.tar.gz cpython-3d26b95ca7ad0f2a39f39606acf2935eb4344e67.tar.bz2 |
Merged revisions 76146 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r76146 | brett.cannon | 2009-11-07 15:55:05 -0800 (Sat, 07 Nov 2009) | 6 lines
When trying to write new bytecode, importlib was not catching the IOError
thrown if the file happened to be read-only to keep the failure silent.
Fixes issue #7187. Thanks, Dave Malcolm for the report and analysis of the
problem.
........
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 24bcff2..03350b5 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -522,9 +522,9 @@ class _PyPycFileLoader(PyPycLoader, _PyFileLoader): bytecode_path = self.bytecode_path(name) if not bytecode_path: bytecode_path = self._base_path + _suffix_list(imp.PY_COMPILED)[0] - file = _io.FileIO(bytecode_path, 'w') # Assuming bytes. try: - with _closing(file) as bytecode_file: + # Assuming bytes. + with _closing(_io.FileIO(bytecode_path, 'w')) as bytecode_file: bytecode_file.write(data) return True except IOError as exc: |