comparison cy_works/qu.pyx @ 68:eb91fd5d49b3

minimally changed to get Cython Queue example working, Cython version
author Henry S Thompson <ht@inf.ed.ac.uk>
date Fri, 17 Jan 2025 15:43:56 +0000
parents
children
comparison
equal deleted inserted replaced
67:eb4be545fcc8 68:eb91fd5d49b3
1 # distutils: sources = c-algorithms/src/queue.c
2 # distutils: include_dirs = c-algorithms/src/
3
4 cimport cqu
5
6 cdef class Queue:
7 cdef cqu.Queue* _c_queue
8
9 def __cinit__(self):
10 self._c_queue = cqu.queue_new()
11 if self._c_queue == NULL:
12 raise MemoryError()
13
14 def __dealloc__(self):
15 if self._c_queue != NULL:
16 cqu.queue_free(self._c_queue)
17
18 cdef testMe():
19 print('testing...')
20 q = Queue()
21 print(cqu.queue_is_empty(q._c_queue))
22 print('tested')
23
24 testMe()