Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/pyarrow/io.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ cdef class MemoryMappedFile(NativeFile):
----------
new_size : new size in bytes
"""
self._assert_open()
check_status(self.handle.get().Resize(new_size))

def fileno(self):
Expand Down
5 changes: 5 additions & 0 deletions python/pyarrow/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,11 @@ def test_memory_map_resize(tmpdir):
assert f.read() == bytes(arr[:SIZE])


def test_memory_map_resize_uninitialized():
Comment thread
1fanwang marked this conversation as resolved.
with pytest.raises(ValueError, match="I/O operation on closed file"):
pa.MemoryMappedFile().resize(0)


Comment thread
AlenkaF marked this conversation as resolved.
def test_memory_zero_length(tmpdir):
path = os.path.join(str(tmpdir), guid())
f = open(path, 'wb')
Expand Down
Loading