diff --git a/numcodecs/registry.py b/numcodecs/registry.py index 64dca304..c11a1b36 100644 --- a/numcodecs/registry.py +++ b/numcodecs/registry.py @@ -29,6 +29,7 @@ def get_codec(config): Zlib(level=1) """ + config = dict(config) codec_id = config.pop('id', None) cls = codec_registry.get(codec_id, None) if cls is None: diff --git a/numcodecs/tests/common.py b/numcodecs/tests/common.py index b3f080e0..76068564 100644 --- a/numcodecs/tests/common.py +++ b/numcodecs/tests/common.py @@ -241,7 +241,6 @@ def check_err_decode_object_buffer(compressor): out = np.empty(10, dtype=object) with pytest.raises(ValueError): compressor.decode(enc, out=out) - print(out[:]) def check_err_encode_object_buffer(compressor): diff --git a/numcodecs/tests/test_registry.py b/numcodecs/tests/test_registry.py index 476388ba..3322e975 100644 --- a/numcodecs/tests/test_registry.py +++ b/numcodecs/tests/test_registry.py @@ -11,3 +11,11 @@ def test_registry_errors(): with pytest.raises(ValueError): get_codec({'id': 'foo'}) + + +def test_get_codec_argument(): + # Check that get_codec doesn't modify its argument. + arg = {"id": "json"} + before = dict(arg) + get_codec(arg) + assert before == arg