Skip to content

Commit

Permalink
Cast memoryview to bytes so that len is correct
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Sep 19, 2024
1 parent 5fdb2e4 commit 215093b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tiled/serialization/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def as_buffer(array, metadata):
# The memoryview path fails for datetime type (and possibly some others?)
# but it generally works for standard types like int, float, bool, str.
try:
return memoryview(numpy.ascontiguousarray(array))
return memoryview(numpy.ascontiguousarray(array)).cast("B")
except ValueError:
return numpy.asarray(array).tobytes()

Expand Down

0 comments on commit 215093b

Please sign in to comment.