[PATCH 7/9] Replace long usage with int (#1014220)
Anne Mulhern
amulhern at redhat.com
Wed Jan 28 22:52:44 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:21 PM
> Subject: [PATCH 7/9] Replace long usage with int (#1014220)
>
> The long data type has been removed in Python 3 and an int should
> be enough for representing the Kernel tainted flag even on Python 2.
>
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
> pyanaconda/iutil.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index 0c59f71..87378f6 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -1004,9 +1004,9 @@ def is_unsupported_hw():
> :rtype: bool
> """
> try:
> - tainted = long(open("/proc/sys/kernel/tainted").read())
> + tainted = int(open("/proc/sys/kernel/tainted").read())
> except (IOError, ValueError):
> - tainted = 0L
> + tainted = 0
>
> status = bool(tainted & UNSUPPORTED_HW)
> if status:
> --
> 2.1.0
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>
Ack. In Python 2.7 int() will automatically convert its result to a long
if the number being converted is too large to represent as an int.
- mulhern
More information about the anaconda-patches
mailing list