BUG: fix build with single-threaded python

Some symbols are not defined leading to:
ImportError Undefined symbol: PyGILState_Release

Closes gh-3255
Merge pull request #4206 from juliantaylor/single-thread-fix

BUG: fix build with single-threaded python