summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTrent Nelson <trent@trent.me>2012-10-16 12:03:21 (GMT)
committerTrent Nelson <trent@trent.me>2012-10-16 12:03:21 (GMT)
commit744faddae87edec1612fa43606d9549f38c944f6 (patch)
tree8945e72b377f16c739add19708aa7e4495edf437 /Lib
parentb3fe704a4af38585c1b7b061d08d720e5fc96225 (diff)
parent8a420227488aa743e20c27368ee64a114c1d651f (diff)
downloadcpython-744faddae87edec1612fa43606d9549f38c944f6.zip
cpython-744faddae87edec1612fa43606d9549f38c944f6.tar.gz
cpython-744faddae87edec1612fa43606d9549f38c944f6.tar.bz2
Merge issue #15833: don't raise an exception if importlib can't write
byte-compiled files. This fixes a regression introduced by 3.3. Patch by Charles-François Natali.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index e088bab..8c83613 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1066,17 +1066,17 @@ class SourceFileLoader(FileLoader, SourceLoader):
except FileExistsError:
# Probably another Python process already created the dir.
continue
- except PermissionError:
- # If can't get proper access, then just forget about writing
- # the data.
+ except OSError as exc:
+ # Could be a permission error, read-only filesystem: just forget
+ # about writing the data.
+ _verbose_message('could not create {!r}: {!r}', parent, exc)
return
try:
_write_atomic(path, data, _mode)
_verbose_message('created {!r}', path)
- except (PermissionError, FileExistsError):
- # Don't worry if you can't write bytecode or someone is writing
- # it at the same time.
- pass
+ except OSError as exc:
+ # Same as above: just don't write the bytecode.
+ _verbose_message('could not create {!r}: {!r}', path, exc)
class SourcelessFileLoader(FileLoader, _LoaderBasics):