Avoid synchronization if not run within Python

If Py_BEGIN_ALLOW_THREADS is called in a process that is not part of Python,
hell _may_ break loose.