diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-10 01:04:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-10 01:04:33 +0000 |
commit | bdf9748377e40813b7794992f656bf1c33516132 (patch) | |
tree | 958ab4f5e3d20941b1c43b50fb419e0fa3cee5c1 /pym | |
parent | 920e551da78dcd0099ab0432f4d4a4b20c7f5051 (diff) | |
download | portage-bdf9748377e40813b7794992f656bf1c33516132.tar.gz portage-bdf9748377e40813b7794992f656bf1c33516132.tar.bz2 portage-bdf9748377e40813b7794992f656bf1c33516132.zip |
When overridding sys.std* in python2, use binary streams. (trunk r14974)
svn path=/main/branches/2.1.7/; revision=15008
Diffstat (limited to 'pym')
-rw-r--r-- | pym/_emerge/BinpkgVerifier.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pym/_emerge/BinpkgVerifier.py b/pym/_emerge/BinpkgVerifier.py index 0283883c1..eebccfa74 100644 --- a/pym/_emerge/BinpkgVerifier.py +++ b/pym/_emerge/BinpkgVerifier.py @@ -35,13 +35,15 @@ class BinpkgVerifier(AsynchronousTask): # so that we get the right class (otherwise our # code that expects the 'buffer' attribute # will break). - open_func = open + log_file = open(_unicode_encode(self.logfile, + encoding=_encodings['fs'], errors='strict'), + mode='a', encoding=_encodings['content'], + errors='backslashreplace') else: - open_func = codecs.open - log_file = open_func(_unicode_encode(self.logfile, - encoding=_encodings['fs'], errors='strict'), - mode='a', encoding=_encodings['content'], - errors='backslashreplace') + # For python2, sys.std* are expected to be binary streams. + log_file = open(_unicode_encode(self.logfile, + encoding=_encodings['fs'], errors='strict'), + mode='ab') try: if log_file is not None: sys.stdout = log_file |