No, f2py by default leaves the GIL in place. However, you can free the GIL by adding the threadsafe directive.
Example:
subroutine foo(a) !f2py threadsafe !f2py intent(out) :: a integer a a = 5 end subroutine foo
Now compile it:
f2py -c -m foo --build-dir test_build foo.f90
And we can check the source code:
grep THREAD test_build/src.*/*.c build/src.linux-x86_64-2.7/testmodule.c: Py_BEGIN_ALLOW_THREADS build/src.linux-x86_64-2.7/testmodule.c: Py_END_ALLOW_THREADS
However, if we repeat the process of deleting the !f2py threadsafe , then the macros for the GIL release will not be included.
source share