Skip to content

Commit

Permalink
Use libcpp.optional provided by Cython.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed Jan 28, 2025
1 parent 1a01b40 commit 31f1211
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions python/pyarrow/lib.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,11 @@ from cpython cimport PyObject
from libcpp cimport nullptr, bool as c_bool
from libcpp.cast cimport dynamic_cast
from libcpp.memory cimport dynamic_pointer_cast
from libcpp.optional cimport optional
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport *
from pyarrow.includes.libarrow_python cimport *

# Will be available in Cython 3, not backported
# ref: https://github.com/cython/cython/issues/3293#issuecomment-1223058101
cdef extern from "<optional>" namespace "std" nogil:
cdef cppclass nullopt_t:
nullopt_t()

cdef nullopt_t nullopt

cdef cppclass optional[T]:
ctypedef T value_type
optional()
optional(nullopt_t)
optional(optional&) except +
optional(T&) except +
c_bool has_value()
T& value()
T& value_or[U](U& default_value)
void swap(optional&)
void reset()
T& emplace(...)
T& operator*()
# T* operator->() # Not Supported
optional& operator=(optional&)
optional& operator=[U](U&)
c_bool operator bool()
c_bool operator!()
c_bool operator==[U](optional&, U&)
c_bool operator!=[U](optional&, U&)
c_bool operator<[U](optional&, U&)
c_bool operator>[U](optional&, U&)
c_bool operator<=[U](optional&, U&)
c_bool operator>=[U](optional&, U&)

optional[T] make_optional[T](...) except +

cdef extern from "Python.h":
int PySlice_Check(object)
Expand Down

0 comments on commit 31f1211

Please sign in to comment.