[Python-checkins] cpython (merge default -> default): Merge
antoine.pitrou
python-checkins at python.org
Fri Aug 24 19:50:39 CEST 2012
http://hg.python.org/cpython/rev/150c58d98a5d
changeset: 78742:150c58d98a5d
parent: 78740:16c0e26fc9cd
parent: 78738:0c661c5632e0
user: Antoine Pitrou <solipsis at pitrou.net>
date: Fri Aug 24 19:47:02 2012 +0200
summary:
Merge
files:
Lib/importlib/_bootstrap.py | 16 +-
Python/importlib.h | 3757 +++++++++++-----------
2 files changed, 1884 insertions(+), 1889 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1042,9 +1042,13 @@
def _cache_bytecode(self, source_path, bytecode_path, data):
# Adapt between the two APIs
- return self.set_data(bytecode_path, data, source_path=source_path)
+ try:
+ mode = _os.stat(source_path).st_mode
+ except OSError:
+ mode = 0o666
+ return self.set_data(bytecode_path, data, _mode=mode)
- def set_data(self, path, data, *, source_path=None):
+ def set_data(self, path, data, *, _mode=0o666):
"""Write bytes data to a file."""
parent, filename = _path_split(path)
path_parts = []
@@ -1064,14 +1068,8 @@
# If can't get proper access, then just forget about writing
# the data.
return
- mode = 0o666
- if source_path is not None:
- try:
- mode = _os.stat(source_path).st_mode
- except OSError:
- pass
try:
- _write_atomic(path, data, mode)
+ _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
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