[Python-checkins] cpython (merge 3.3 -> default): Closes #16340: Merged fix from 3.3.
vinay.sajip
python-checkins at python.org
Sun Oct 28 13:42:46 CET 2012
http://hg.python.org/cpython/rev/fb969187ecc2
changeset: 80028:fb969187ecc2
parent: 80020:27ce005372a5
parent: 80027:adefc83c1128
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Sun Oct 28 12:40:20 2012 +0000
summary:
Closes #16340: Merged fix from 3.3.
files:
Lib/venv/__init__.py | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -313,11 +313,17 @@
mode = 'wb'
else:
mode = 'w'
- data = data.decode('utf-8')
- data = self.replace_variables(data, context)
- with open(dstfile, mode) as f:
- f.write(data)
- shutil.copymode(srcfile, dstfile)
+ try:
+ data = data.decode('utf-8')
+ data = self.replace_variables(data, context)
+ except UnicodeDecodeError as e:
+ data = None
+ logger.warning('unable to copy script %r, '
+ 'may be binary: %s', srcfile, e)
+ if data is not None:
+ with open(dstfile, mode) as f:
+ f.write(data)
+ shutil.copymode(srcfile, dstfile)
def create(env_dir, system_site_packages=False, clear=False, symlinks=False):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list