Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't pack an empty array: ZeroDivisionError: integer modulo by zero #290

Open
fyrestone opened this issue Oct 17, 2024 · 1 comment
Open

Comments

@fyrestone
Copy link

I am not sure if this is by design, but it would be good if blocs2 can support an empty array as well.

import numpy as np
import blosc2

print(np.__version__)
print(blosc2.__version__)

empty = np.zeros((0,), dtype=float)
blosc2.pack_tensor(empty)

Output:

1.26.4
3.0.0b4
Traceback (most recent call last):
  File "blocs2_bug2.py", line 8, in <module>
    blosc2.pack_tensor(empty)
  File "/Users/admin/.pyenv/versions/miniconda3-3.11-23.11.0-2/lib/python3.11/site-packages/blosc2/core.py", line 644, in pack_tensor
    schunk = blosc2.SChunk(chunksize=chunksize, data=arr, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/.pyenv/versions/miniconda3-3.11-23.11.0-2/lib/python3.11/site-packages/blosc2/schunk.py", line 284, in __init__
    super().__init__(_schunk=sc, chunksize=chunksize, data=data, **kwargs)
  File "blosc2_ext.pyx", line 1017, in blosc2.blosc2_ext.SChunk.__init__
ZeroDivisionError: integer modulo by zero
@fyrestone fyrestone changed the title Can't pack empty array: ZeroDivisionError: integer modulo by zero Can't pack an empty array: ZeroDivisionError: integer modulo by zero Oct 17, 2024
@FrancescAlted
Copy link
Member

Sure. PRs welcome :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants