From 88eff0278d9428c9cd6f7559ee318c8d3b55f042 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 9 Nov 2026 09:33:33 +0000 Subject: [PATCH] amt: ensure we initialize with Decimal type --- mmgen/amt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmgen/amt.py b/mmgen/amt.py index f7ce7294..a987b3d8 100644 --- a/mmgen/amt.py +++ b/mmgen/amt.py @@ -134,19 +134,19 @@ class CoinAmt(Decimal, Hilite, InitErrors): # abstract class we must allow other to be int(0) to use the sum() builtin """ if type(other) in (type(self), Decimal) or (other == 0 and isinstance(other, int)): - return type(self)(Decimal.__add__(self, other), from_decimal=True, decimals=decimals, **kwargs) + return type(self)(Decimal(Decimal.__add__(self, other)), from_decimal=True, decimals=decimals, **kwargs) self.incorrect_type_error(other) __radd__ = __add__ def __sub__(self, other, decimals=None, **kwargs): if type(other) in (type(self), Decimal): - return type(self)(Decimal.__sub__(self, other), from_decimal=True, decimals=decimals, **kwargs) + return type(self)(Decimal(Decimal.__sub__(self, other)), from_decimal=True, decimals=decimals, **kwargs) self.incorrect_type_error(other) def __rsub__(self, other, decimals=None, **kwargs): if type(other) is type(self): - return type(self)(Decimal.__rsub__(self, other), from_decimal=True, decimals=decimals, **kwargs) + return type(self)(Decimal(Decimal.__rsub__(self, other)), from_decimal=True, decimals=decimals, **kwargs) self.incorrect_type_error(other) def __mul__(self, other, decimals=None, **kwargs):