Fix #48: use PyGILState_Ensure/Release for GIL

For some reason Py_BEGIN/END_ALLOW_THREADS is not working but directly releasing
the GIL is ...