Fix decimal._convert_other to work with Float on Python 2.7
review132001
This commit is contained in:
1 parent
cc48eb8532
commit
7e3cb52f7f
1 file changed
+10
@@ -1,7 +1,17 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import decimal
|
||||
from decimal import Decimal
|
||||
|
||||
_convert_other = decimal._convert_other
|
||||
|
||||
def _convert_Float(other, *args, **kwargs):
|
||||
if isinstance(other, Float):
|
||||
return other.decimal
|
||||
return _convert_other(other, *args, **kwargs)
|
||||
decimal._convert_other = _convert_Float
|
||||
|
||||
|
||||
class Float(float):
|
||||
def __init__(self, value):
|
||||
super(Float, self).__init__()
|
||||
|
||||
Reference in new issue
Block a user