Skip to content

Commit

Permalink
apacheGH-38857: [Python] Fix append mode for cython 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Dec 1, 2023
1 parent 63bd0d5 commit 38e8a4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/pyarrow/includes/libarrow.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,8 @@ cdef extern from "arrow/io/api.h" namespace "arrow::io" nogil:
CResult[shared_ptr[COutputStream]] Open(const c_string& path)

@staticmethod
CResult[shared_ptr[COutputStream]] Open(const c_string& path, c_bool append)
CResult[shared_ptr[COutputStream]] OpenWithAppend" Open"(
const c_string& path, c_bool append)

int file_descriptor()

Expand Down
4 changes: 3 additions & 1 deletion python/pyarrow/io.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,9 @@ cdef class OSFile(NativeFile):

cdef _open_writable(self, c_string path, c_bool append=False):
with nogil:
self.output_stream = GetResultValue(FileOutputStream.Open(path, append))
self.output_stream = GetResultValue(
FileOutputStream.OpenWithAppend(path, append)
)
self.is_writable = True
self._is_appending = append

Expand Down

0 comments on commit 38e8a4e

Please sign in to comment.