[test] functional framework: add CScript hex() for Python 3.4

test/functional/wallet_importmulti.py failed with:
AttributeError: 'CScript' object has no attribute 'hex'
This commit is contained in:
Sjors Provoost 2018-12-12 11:08:53 +01:00
parent 74ce326831
commit 31926ee8cf
No known key found for this signature in database
GPG Key ID: 57FF9BDBCC301009

View File

@ -450,6 +450,10 @@ class CScript(bytes):
# join makes no sense for a CScript()
raise NotImplementedError
# Python 3.4 compatibility
def hex(self):
return hexlify(self).decode('ascii')
def __new__(cls, value=b''):
if isinstance(value, bytes) or isinstance(value, bytearray):
return super(CScript, cls).__new__(cls, value)