From: Zac Medico Date: Mon, 12 Jul 2010 10:49:13 +0000 (-0700) Subject: Fix writemsg to only use fd.buffer when it is stderr or stdout. X-Git-Tag: v2.2_rc68~513 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f9197545f7686d610d6d153fb2dbbb4d4d65bb7e;p=portage.git Fix writemsg to only use fd.buffer when it is stderr or stdout. --- diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 3c552025b..821428d12 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -58,7 +58,7 @@ def writemsg(mystr,noiselevel=0,fd=None): # avoid potential UnicodeEncodeError mystr = _unicode_encode(mystr, encoding=_encodings['stdio'], errors='backslashreplace') - if sys.hexversion >= 0x3000000: + if sys.hexversion >= 0x3000000 and fd in (sys.stdout, sys.stderr): fd = fd.buffer fd.write(mystr) fd.flush()