blob: 1c235a8837da92b9c4e9b514923c2ef2e0e16722 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import cython
from cython.cimports.libc.stdlib import free
@cython.cclass
class OwnedPointer:
ptr: cython.pointer(cython.void)
def __dealloc__(self):
if self.ptr is not cython.NULL:
free(self.ptr)
@staticmethod
@cython.cfunc
def create(ptr: cython.pointer(cython.void)):
p = OwnedPointer()
p.ptr = ptr
return p
|