diff --git a/tests/core/contracts/test_contract_call_interface.py b/tests/core/contracts/test_contract_call_interface.py index 8a567f3253..27c0fd8ef1 100644 --- a/tests/core/contracts/test_contract_call_interface.py +++ b/tests/core/contracts/test_contract_call_interface.py @@ -2,9 +2,13 @@ Decimal, getcontext, ) +from distutils.version import ( + LooseVersion, +) import json import pytest +import eth_abi from hexbytes import ( HexBytes, ) @@ -184,6 +188,9 @@ def test_call_get_string_value(string_contract, call): assert result == "Caqalai" +@pytest.mark.skipif( + LooseVersion(eth_abi.__version__) >= LooseVersion("2"), + reason="eth-abi >=2 does utf-8 string decoding") def test_call_read_string_variable(string_contract, call): result = call(contract=string_contract, contract_function='constValue') diff --git a/web3/utils/normalizers.py b/web3/utils/normalizers.py index 7e7d266076..d4c0a2a9c3 100644 --- a/web3/utils/normalizers.py +++ b/web3/utils/normalizers.py @@ -1,8 +1,12 @@ import codecs +from distutils.version import ( + LooseVersion, +) import functools import json +import eth_abi from eth_abi.abi import ( process_type, ) @@ -140,11 +144,14 @@ def abi_ens_resolver(w3, abi_type, val): BASE_RETURN_NORMALIZERS = [ - addresses_checksummed, - decode_abi_strings, + addresses_checksummed ] +if LooseVersion(eth_abi.__version__) < LooseVersion("2"): + BASE_RETURN_NORMALIZERS.append(decode_abi_strings) + + # # Property Normalizers #