Skip to content
Advertisement

Tag: gil

Does calling a c function via ctypes in python release the GIL during execution of the C code

I want to call some c function from python to be able to improve performance of my code. But I cannot find online whether when I call a C function using the ctypes libraries the GIL is released. As a simple example: Is the GIL released during the call to fun.sleep? Answer According to [Python.Docs]: ctypes.CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) (emphasis

Do I need to use `nogil` in Cython

I have some Cython code that I’d like to run as quickly as possible. Do I need to release the GIL in order to do this? Let’s suppose my code is similar to this: I get a whole load of error messages from the np.zeros_like line similar to: Do I need to find a way of calling np.zeros_like without the

Advertisement