8000 Incorrect default fill value causes byte arrays to become numeric when `write_empty_chunks=False` · Issue #965 · zarr-developers/zarr-python · GitHub
[go: up one dir, main page]

Skip to content
Incorrect default fill value causes byte arrays to become numeric when write_empty_chunks=False #965
Closed
@benjeffery

Description

@benjeffery

Minimal example:

import zarr
a = zarr.create((1,), dtype=bytes)
a[0] = b''
assert a[0] == b''

Traceback (most recent call last):
  File "example.py", line 5, in <module>
    assert a[0] == b''
AssertionError

The value of a[0] is actually 0, when it should be b''.

Found by one of our users at tskit-dev/tsinfer#628 this bug was introduced in the latest release (v2.11.0) in this commit: f461eb7 when the default for write_empty_chunks was changed to False. The default fill_value for arrays created via zarr.creation.create is 0, so when an empty, unwritten chunk is re-created the previous value b'' becomes 0. I assume this fill_value should be None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0