Using function pointers to methods of classes without the gil

You can use with gil: around the blocks that need the GIL, and then with nogil: around the important inner blocks that will take most of your run time. To give a trivial example from cython.parallel import prange cdef class Simulation: cdef double some_detail def __cinit__(self,double some_detail): self.some_detail = some_detail def do_long_calculation(self, double v): with … Read more

What does language_level in for cython do?

Building a cython extension is a two-step proccess: creating the foo.c-file from foo.pyx file using PythonX+cython-module. X could be here 2.7, 3.7 or whatever version you prefer. creating the corresponding so-file (or pyd on Windows) with help of compiler and includes of PythonY and corresponding shared library. Here Y doesn’t have to be X, but … Read more