[PATCH 3/6] Discard partial bytes in Size constructor.

Anne Mulhern amulhern at redhat.com
Sat Dec 21 21:35:01 UTC 2013





----- Original Message -----
> From: "David Lehman" <dlehman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Friday, December 20, 2013 12:59:56 PM
> Subject: [PATCH 3/6] Discard partial bytes in Size constructor.
> 
> ---
>  blivet/size.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/blivet/size.py b/blivet/size.py
> index aaa3062..46a7747 100644
> --- a/blivet/size.py
> +++ b/blivet/size.py
> @@ -155,7 +155,8 @@ class Size(Decimal):
>  
>          if bytes is not None:
>              if type(bytes).__name__ in ["int", "long", "float", 'Decimal']
>              and bytes >= 0:
> -                self = Decimal.__new__(cls, value=bytes)
> +                # sorry, but no partial bytes
> +                self = Decimal.__new__(cls, value=int(bytes))
>              else:
>                  raise SizeNotPositiveError("bytes= param must be >=0")
>          elif spec:
> --
> 1.8.1.4

I agree w/ the "no partial bytes" sentiment. But it looks like it is not enforced for the spec and en_spec cases.

- mulhern

> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 


More information about the anaconda-patches mailing list