BUG: fix build with single-threaded python

Some symbols are not defined leading to:
ImportError Undefined symbol: PyGILState_Release

Closes gh-3255