On Fri, 2012-03-30 at 14:08 +0200, Zdeněk Pavlas wrote:
> sys.stdin is usually a file, so we must write encoded strings to it.

 You mean s/stdin/stdout/ here, right? And I'm pretty sure that's not
true.

> yum.misc.setup_locale() may choose to replace it with StreamWriter
> which expects unicode and breaks on UTF8.
>
> ---
>  yum/misc.py |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/yum/misc.py b/yum/misc.py
> index 5321003..2bc70b7 100644
> --- a/yum/misc.py
> +++ b/yum/misc.py
> @@ -1009,6 +1009,7 @@ def setup_locale(override_codecs=True, 
> override_time=False):
>          import codecs
>          sys.stdout = 
> codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
>          sys.stdout.errors = 'replace'
> +        sys.stdout.write = lambda s, write=sys.stdout.write: 
> write(to_unicode(s))

 This seems dangerous, but maybe it isn't that bad ... the only problem
is that the only way I think we can find out is to shove it out into
Fedora and see if we get more or less unicide bugs.

 Toshio said that we should use:

http://bzr.fedorahosted.org/bzr/kitchen/devel/annotate/head:/kitchen/text/converters.py#L300

...instead of the above codecs.getwriter(), and that should "solve" the
backtraces.

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to