[PATCH 9/9] Make range usage Python 3 compatible (#1014220)

Anne Mulhern amulhern at redhat.com
Wed Jan 28 23:12:38 UTC 2015





----- Original Message -----
> From: "Martin Kolman" <mkolman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, January 28, 2015 12:43:23 PM
> Subject: [PATCH 9/9] Make range usage Python 3 compatible (#1014220)
> 
> Range returns an iterator in Python 3, wrap it in list() so that
> code that expects a list keeps working.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  pyanaconda/ui/gui/__init__.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
> index 3927353..37484c6 100644
> --- a/pyanaconda/ui/gui/__init__.py
> +++ b/pyanaconda/ui/gui/__init__.py
> @@ -560,7 +560,7 @@ class GraphicalUserInterface(UserInterface):
>              (handler, signum) = user_data
>              handler(signum, None)
>  
> -        for signum in range(1, signal.SIGCHLD) + range(signal.SIGCHLD + 1,
> signal.NSIG):
> +        for signum in list(range(1, signal.SIGCHLD)) +
> list(range(signal.SIGCHLD + 1, signal.NSIG)):


for signum in itertools.chain(range(1, signal.SIGHLD), range(signal.SIGCHLD + 1, signal.NSIG)):

OR

for signum in (s for s in range(1, signal.NSIG) if s != signal.SIGCHLD):

both seem less awkward.

>              handler = signal.getsignal(signum)
>              if handler and handler not in (signal.SIG_DFL, signal.SIG_IGN):
>                  # NB: if you are looking at the glib documentation you are
>                  in for
> --
> 2.1.0
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

- mulhern


More information about the anaconda-patches mailing list