[Yum-devel] [PATCH] Work around python readline braindamage, BZ 448864. Sickest hack ever.

David Malcolm dmalcolm at redhat.com
Mon Sep 13 20:43:33 UTC 2010


On Mon, 2010-09-13 at 12:17 -0400, James Antill wrote:
> ---
>  shell.py |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/shell.py b/shell.py
> index a32e880..b22097c 100644
> --- a/shell.py
> +++ b/shell.py
> @@ -74,6 +74,34 @@ class YumShell(cmd.Cmd):
>                  raise Errors.YumBaseError, "Fatal error in script, exiting"
>          
>          return inputs
> +
> +    def cmdloop(self, *args, **kwargs):
> +        """ Sick hack for readline. """
> +        global raw_input
> +
> +        oraw_input = raw_input
> +        owriter    = sys.stdout
> +        _ostdout   = owriter.stream

FWIW, note that Python stores the wrapper for the original stdout FILE*
as sys.__stdout__ (don't go changing it!).

[snip]

Hope this is helpful
Dave



More information about the Yum-devel mailing list