[blivet][PATCH] Use Decimal for math in Size.convertTo.

David Lehman dlehman at redhat.com
Fri Sep 26 16:56:02 UTC 2014


Size.__div__ converts the Decimal result to a Size, which rounds its
numerical argument (byte count) down to an integer. Size.convertTo is
meant to retain precision.
---
 blivet/size.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blivet/size.py b/blivet/size.py
index 4c23c11..f2a32ce 100644
--- a/blivet/size.py
+++ b/blivet/size.py
@@ -269,7 +269,7 @@ class Size(Decimal):
             check = _makeSpecs(prefix, abbr, False)
 
             if spec in check:
-                return Decimal(self / Decimal(factor))
+                return Decimal(Decimal(self) / Decimal(factor))
 
         return None
 
-- 
1.9.3



More information about the anaconda-patches mailing list