Skip to content

Commit

Permalink
Add PyCapsule to Python bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
arshajii committed Nov 7, 2023
1 parent ad504b7 commit 4eb641e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions stdlib/internal/python.codon
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PyComplex_ImagAsDouble = Function[[cobj], float](cobj())
PyIter_Next = Function[[cobj], cobj](cobj())
PySlice_New = Function[[cobj, cobj, cobj], cobj](cobj())
PySlice_Unpack = Function[[cobj, Ptr[int], Ptr[int], Ptr[int]], int](cobj())
PyCapsule_New = Function[[cobj, cobj, cobj], cobj](cobj())
PyCapsule_GetPointer = Function[[cobj, cobj], cobj](cobj())

# number
PyNumber_Add = Function[[cobj, cobj], cobj](cobj())
Expand Down Expand Up @@ -133,6 +135,7 @@ PyDict_Type = cobj()
PySet_Type = cobj()
PyTuple_Type = cobj()
PySlice_Type = cobj()
PyCapsule_Type = cobj()

# exceptions
PyExc_BaseException = cobj()
Expand Down Expand Up @@ -232,6 +235,8 @@ def init_handles_dlopen(py_handle: cobj):
global PyIter_Next
global PySlice_New
global PySlice_Unpack
global PyCapsule_New
global PyCapsule_GetPointer
global PyNumber_Add
global PyNumber_Subtract
global PyNumber_Multiply
Expand Down Expand Up @@ -301,6 +306,7 @@ def init_handles_dlopen(py_handle: cobj):
global PySet_Type
global PyTuple_Type
global PySlice_Type
global PyCapsule_Type
global PyExc_BaseException
global PyExc_Exception
global PyExc_NameError
Expand Down Expand Up @@ -361,6 +367,8 @@ def init_handles_dlopen(py_handle: cobj):
PyIter_Next = dlsym(py_handle, "PyIter_Next")
PySlice_New = dlsym(py_handle, "PySlice_New")
PySlice_Unpack = dlsym(py_handle, "PySlice_Unpack")
PyCapsule_New = dlsym(py_handle, "PyCapsule_New")
PyCapsule_GetPointer = dlsym(py_handle, "PyCapsule_GetPointer")
PyNumber_Add = dlsym(py_handle, "PyNumber_Add")
PyNumber_Subtract = dlsym(py_handle, "PyNumber_Subtract")
PyNumber_Multiply = dlsym(py_handle, "PyNumber_Multiply")
Expand Down Expand Up @@ -430,6 +438,7 @@ def init_handles_dlopen(py_handle: cobj):
PySet_Type = dlsym(py_handle, "PySet_Type")
PyTuple_Type = dlsym(py_handle, "PyTuple_Type")
PySlice_Type = dlsym(py_handle, "PySlice_Type")
PyCapsule_Type = dlsym(py_handle, "PyCapsule_Type")
PyExc_BaseException = Ptr[cobj](dlsym(py_handle, "PyExc_BaseException"))[0]
PyExc_Exception = Ptr[cobj](dlsym(py_handle, "PyExc_Exception"))[0]
PyExc_NameError = Ptr[cobj](dlsym(py_handle, "PyExc_NameError"))[0]
Expand Down Expand Up @@ -491,6 +500,8 @@ def init_handles_static():
from C import PyIter_Next(cobj) -> cobj as _PyIter_Next
from C import PySlice_New(cobj, cobj, cobj) -> cobj as _PySlice_New
from C import PySlice_Unpack(cobj, Ptr[int], Ptr[int], Ptr[int]) -> int as _PySlice_Unpack
from C import PyCapsule_New(cobj, cobj, cobj) -> cobj as _PyCapsule_New
from C import PyCapsule_GetPointer(cobj, cobj) -> cobj as _PyCapsule_GetPointer
from C import PyNumber_Add(cobj, cobj) -> cobj as _PyNumber_Add
from C import PyNumber_Subtract(cobj, cobj) -> cobj as _PyNumber_Subtract
from C import PyNumber_Multiply(cobj, cobj) -> cobj as _PyNumber_Multiply
Expand Down Expand Up @@ -560,6 +571,7 @@ def init_handles_static():
from C import PySet_Type: cobj as _PySet_Type
from C import PyTuple_Type: cobj as _PyTuple_Type
from C import PySlice_Type: cobj as _PySlice_Type
from C import PyCapsule_Type: cobj as _PyCapsule_Type
from C import PyExc_BaseException: cobj as _PyExc_BaseException
from C import PyExc_Exception: cobj as _PyExc_Exception
from C import PyExc_NameError: cobj as _PyExc_NameError
Expand Down Expand Up @@ -620,6 +632,8 @@ def init_handles_static():
global PyIter_Next
global PySlice_New
global PySlice_Unpack
global PyCapsule_New
global PyCapsule_GetPointer
global PyNumber_Add
global PyNumber_Subtract
global PyNumber_Multiply
Expand Down Expand Up @@ -689,6 +703,7 @@ def init_handles_static():
global PySet_Type
global PyTuple_Type
global PySlice_Type
global PyCapsule_Type
global PyExc_BaseException
global PyExc_Exception
global PyExc_NameError
Expand Down Expand Up @@ -749,6 +764,8 @@ def init_handles_static():
PyIter_Next = _PyIter_Next
PySlice_New = _PySlice_New
PySlice_Unpack = _PySlice_Unpack
PyCapsule_New = _PyCapsule_New
PyCapsule_GetPointer = _PyCapsule_GetPointer
PyNumber_Add = _PyNumber_Add
PyNumber_Subtract = _PyNumber_Subtract
PyNumber_Multiply = _PyNumber_Multiply
Expand Down Expand Up @@ -818,6 +835,7 @@ def init_handles_static():
PySet_Type = __ptr__(_PySet_Type).as_byte()
PyTuple_Type = __ptr__(_PyTuple_Type).as_byte()
PySlice_Type = __ptr__(_PySlice_Type).as_byte()
PyCapsule_Type = __ptr__(_PyCapsule_Type).as_byte()
PyExc_BaseException = _PyExc_BaseException
PyExc_Exception = _PyExc_Exception
PyExc_NameError = _PyExc_NameError
Expand Down

0 comments on commit 4eb641e

Please sign in to comment.