From 51c020bc6876db28173fd81ac0597483c747dd82 Mon Sep 17 00:00:00 2001 From: mdr0id Date: Wed, 11 Dec 2019 19:23:12 -0800 Subject: [PATCH] Use upstream encoding for encodeDecimal --- qa/rpc-tests/test_framework/authproxy.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/qa/rpc-tests/test_framework/authproxy.py b/qa/rpc-tests/test_framework/authproxy.py index eaba1c1d7..5addd2674 100644 --- a/qa/rpc-tests/test_framework/authproxy.py +++ b/qa/rpc-tests/test_framework/authproxy.py @@ -52,8 +52,12 @@ class JSONRPCException(Exception): self.error = rpc_error def EncodeDecimal(o): + print(repr(o)) + print(type(o)) + print(type(decimal.Decimal)) if isinstance(o, decimal.Decimal): - return float(o) + print("isinstance Decimal") + return str(o) raise TypeError(repr(o) + " is not JSON serializable") @@ -88,19 +92,6 @@ class AuthServiceProxy(): timeout=timeout) else: self.__conn = HTTPConnection(self.__url.hostname, port, timeout=timeout) - - - def _set_conn(self, connection=None): - port = 80 if self.__url.port is None else self.__url.port - if connection: - self.__conn = connection - self.timeout = connection.timeout - elif self.__url.scheme == 'https': - self.__conn = http.client.HTTPSConnection(self.__url.hostname, port, timeout=self.timeout) - else: - self.__conn = http.client.HTTPConnection(self.__url.hostname, port, timeout=self.timeout) - - def __getattr__(self, name): if name.startswith('__') and name.endswith('__'):