Skip to content

Commit 4690dd6

Browse files
committed
Add comment about .tobytes()
1 parent 1ed7e1e commit 4690dd6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎astropy/io/fits/_tiled_compression/codecs.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def decode(self, buf):
6363
buf : np.ndarray
6464
The decompressed buffer.
6565
"""
66+
# In principle we should be able to not have .tobytes() here and avoid
67+
# the copy but this does not work correctly in Python 3.11.
6668
cbytes = np.frombuffer(buf, dtype=np.uint8).tobytes()
6769
dbytes = gzip_decompress(cbytes)
6870
return np.frombuffer(dbytes, dtype=np.uint8)
@@ -81,6 +83,8 @@ def encode(self, buf):
8183
bytes
8284
The compressed bytes.
8385
"""
86+
# In principle we should be able to not have .tobytes() here and avoid
87+
# the copy but this does not work correctly in Python 3.11.
8488
dbytes = np.asarray(buf).tobytes()
8589
return gzip_compress(dbytes)
8690

0 commit comments

Comments
 (0)