diff options
author | Trent Nelson <trent@trent.me> | 2012-10-16 11:47:34 (GMT) |
---|---|---|
committer | Trent Nelson <trent@trent.me> | 2012-10-16 11:47:34 (GMT) |
commit | d783c8ed00e251053a10f48a25fbd9b7944e7000 (patch) | |
tree | 5256afb504a65eac867c3087a6fe24b4d8037cbc /Lib/importlib | |
parent | 03cb99c2d11da44304e67281f3e2e87b1cc17254 (diff) | |
download | cpython-d783c8ed00e251053a10f48a25fbd9b7944e7000.zip cpython-d783c8ed00e251053a10f48a25fbd9b7944e7000.tar.gz cpython-d783c8ed00e251053a10f48a25fbd9b7944e7000.tar.bz2 |
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/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index fad95a6..8a20c5e 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): |