| Norbert Thiebaud | eb96e43 | 2013-01-31 04:12:46 -0600 | [diff] [blame] | 1 | iff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py |
| 2 | --- a/Lib/importlib/_bootstrap.py |
| 3 | +++ b/Lib/importlib/_bootstrap.py |
| 4 | @@ -1066,17 +1066,17 @@ class SourceFileLoader(FileLoader, Sourc |
| 5 | except FileExistsError: |
| 6 | # Probably another Python process already created the dir. |
| 7 | continue |
| 8 | - except PermissionError: |
| 9 | - # If can't get proper access, then just forget about writing |
| 10 | - # the data. |
| 11 | + except OSError as exc: |
| 12 | + # Could be a permission error, read-only filesystem: just forget |
| 13 | + # about writing the data. |
| 14 | + _verbose_message('could not create {!r}: {!r}', parent, exc) |
| 15 | return |
| 16 | try: |
| 17 | _write_atomic(path, data, _mode) |
| 18 | _verbose_message('created {!r}', path) |
| 19 | - except (PermissionError, FileExistsError): |
| 20 | - # Don't worry if you can't write bytecode or someone is writing |
| 21 | - # it at the same time. |
| 22 | - pass |
| 23 | + except OSError as exc: |
| 24 | + # Same as above: just don't write the bytecode. |
| 25 | + _verbose_message('could not create {!r}: {!r}', path, exc) |