Browse Source

test_framework: Avoid infinite loop in encoding Decimal

Avoid an infinite loop in encoding, by ensuring EncodeDecimal
returns a string. round(Decimal) used to convert it to
float, but it no longer does in python 3.x. Strings are
supported since #6380, so just use that.
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
d7b80b54fb
  1. 2
      qa/rpc-tests/test_framework/authproxy.py

2
qa/rpc-tests/test_framework/authproxy.py

@ -61,7 +61,7 @@ class JSONRPCException(Exception): @@ -61,7 +61,7 @@ class JSONRPCException(Exception):
def EncodeDecimal(o):
if isinstance(o, decimal.Decimal):
return round(o, 8)
return str(o)
raise TypeError(repr(o) + " is not JSON serializable")
class AuthServiceProxy(object):

Loading…
Cancel
Save