From d7b80b54fbb73acc92ddee84697ac4cc10d4d336 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 28 Mar 2016 11:44:19 +0200 Subject: [PATCH 1/2] 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. --- qa/rpc-tests/test_framework/authproxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/rpc-tests/test_framework/authproxy.py b/qa/rpc-tests/test_framework/authproxy.py index fba469a0d..cfc254da0 100644 --- a/qa/rpc-tests/test_framework/authproxy.py +++ b/qa/rpc-tests/test_framework/authproxy.py @@ -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): From e7e48ba66cb597621a30945da9ca7fc36a6dc84c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 28 Mar 2016 12:28:49 +0200 Subject: [PATCH 2/2] test_framework: Py3.4 compat: Specify timeout parameter by name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed in version 3.4: The strict parameter was removed. HTTP 0.9-style “Simple Responses” are not longer supported. (https://docs.python.org/3/library/http.client.html) Source: https://github.com/jgarzik/python-bitcoinrpc/commit/7ebeebb4f61917fe590d980cb4f9aefdce2c8f25 --- qa/rpc-tests/test_framework/authproxy.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qa/rpc-tests/test_framework/authproxy.py b/qa/rpc-tests/test_framework/authproxy.py index cfc254da0..1eb277259 100644 --- a/qa/rpc-tests/test_framework/authproxy.py +++ b/qa/rpc-tests/test_framework/authproxy.py @@ -92,11 +92,10 @@ class AuthServiceProxy(object): self.__conn = connection elif self.__url.scheme == 'https': self.__conn = httplib.HTTPSConnection(self.__url.hostname, port, - None, None, False, - timeout) + timeout=timeout) else: self.__conn = httplib.HTTPConnection(self.__url.hostname, port, - False, timeout) + timeout=timeout) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'):