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

David Lehman dlehman at redhat.com
Fri Dec 20 17:59:56 UTC 2013


---
 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



More information about the anaconda-patches mailing list