Browse Source

Fix compilation error when compiling Python without threads

rdb 10 years ago
parent
commit
a7d56f0e65
1 changed files with 4 additions and 0 deletions
  1. 4 0
      dtool/src/dtoolutil/executionEnvironment.cxx

+ 4 - 0
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
       // marked BLOCKING, which releases the Python thread state, we
       // have to temporarily re-establish our thread state in the
       // have to temporarily re-establish our thread state in the
       // Python interpreter.
       // Python interpreter.
+#ifdef WITH_THREAD
       PyGILState_STATE state = PyGILState_Ensure();
       PyGILState_STATE state = PyGILState_Ensure();
+#endif
 
 
       Filename main_dir;
       Filename main_dir;
       PyObject *obj = PySys_GetObject((char*) "argv");  // borrowed reference
       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);
       PyGILState_Release(state);
+#endif
 
 
       if (main_dir.empty()) {
       if (main_dir.empty()) {
         // We must be running in the Python interpreter directly, so return the CWD.
         // We must be running in the Python interpreter directly, so return the CWD.