[Python-checkins] cpython (3.3): Issue #15833: don't raise an exception if importlib can't write byte-compiled
trent.nelson
python-checkins at python.org
Tue Oct 16 13:49:15 CEST 2012
http://hg.python.org/cpython/rev/53ce30b62de2
changeset: 79741:53ce30b62de2
branch: 3.3
parent: 79735:0a0b890508d3
user: Trent Nelson <trent at trent.me>
date: Tue Oct 16 07:47:34 2012 -0400
summary:
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.
files:
Lib/importlib/_bootstrap.py | 14 +-
Misc/NEWS | 4 +
Python/importlib.h | 3750 +++++++++++-----------
3 files changed, 1889 insertions(+), 1879 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1066,17 +1066,17 @@
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):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -127,6 +127,10 @@
Build
-----
+- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being
+ raised if importlib failed to write byte-compiled files. This affected
+ attempts to build Python out-of-tree from a read-only source directory.
+
- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError
after 2801bf875a24 (see #15801).
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list