Skip to content

Commit

Permalink
Merge pull request #913 from eslavich/PR-909-2.7.x
Browse files Browse the repository at this point in the history
PR 909 2.7.x
  • Loading branch information
eslavich authored Jan 15, 2021
2 parents 7c98ef7 + 09e1cb8 commit dea60c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- Fix bug causing test collection failures in some environments. [#889]

- Fix bug when decompressing arrays with numpy 1.20. [#901]
- Fix bug when decompressing arrays with numpy 1.20. [#901, #909]

2.7.1 (2020-08-18)
------------------
Expand Down
12 changes: 5 additions & 7 deletions asdf/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,11 @@ def decompress(fd, used_size, data_size, compression):
decoded = decoder.flush()
if i + len(decoded) > data_size:
raise ValueError("Decompressed data too long")
elif i + len(decoded) < data_size:
raise ValueError("Decompressed data too short")
# Previous versions of numpy permitted assignment of an
# empty bytes object to an empty array range, but starting
# with numpy 1.20 this raises an error.
elif len(decoded) > 0:
buffer[i:i+len(decoded)] = decoded
buffer.data[i:i+len(decoded)] = decoded
i += len(decoded)

if i < data_size:
raise ValueError("Decompressed data too short")

return buffer

Expand Down

0 comments on commit dea60c5

Please sign in to comment.