From a7d56f0e653da39697bed1488d548dd119f4bff2 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 21 Jun 2015 17:41:28 +0200 Subject: [PATCH] Fix compilation error when compiling Python without threads --- dtool/src/dtoolutil/executionEnvironment.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index 3e1543ba4d..a51fb7741c 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -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.