Fix compilation error when compiling Python without threads

This commit is contained in:
rdb 2015-06-21 17:41:28 +02:00
parent f87785d2c0
commit a7d56f0e65

View File

@ -272,7 +272,9 @@ ns_get_environment_variable(const string &var) const {
// marked BLOCKING, which releases the Python thread state, we
// have to temporarily re-establish our thread state in the
// Python interpreter.
#ifdef WITH_THREAD
PyGILState_STATE state = PyGILState_Ensure();
#endif
Filename main_dir;
PyObject *obj = PySys_GetObject((char*) "argv"); // borrowed reference
@ -303,7 +305,9 @@ ns_get_environment_variable(const string &var) const {
}
}
#ifdef WITH_THREAD
PyGILState_Release(state);
#endif
if (main_dir.empty()) {
// We must be running in the Python interpreter directly, so return the CWD.