minor cleanups
authorStefan Behnel <scoder@users.berlios.de>
Thu, 19 Mar 2009 15:45:48 +0000 (16:45 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 19 Mar 2009 15:45:48 +0000 (16:45 +0100)
Cython/Compiler/Nodes.py

index d9254ad0ad7709b871edcaa6c391de3ea14c632d..f69cd3a214cb2f0696892bc6eccea33dbc6d7cc2 100644 (file)
@@ -1075,7 +1075,7 @@ class FuncDefNode(StatNode, BlockNode):
         # ----- GIL acquisition
         acquire_gil = self.need_gil_acquisition(lenv)
         if acquire_gil:
-            env.use_utility_code(py23_init_threads_utility_code)
+            env.use_utility_code(force_init_threads_utility_code)
             code.putln("PyGILState_STATE _save = PyGILState_Ensure();")
         # ----- Automatic lead-ins for certain special functions
         if not lenv.nogil:
@@ -4529,7 +4529,7 @@ class GILStatNode(TryFinallyStatNode):
             finally_clause = GILExitNode(pos, state = state))
 
     def analyse_expressions(self, env):
-        env.use_utility_code(py23_init_threads_utility_code)
+        env.use_utility_code(force_init_threads_utility_code)
         was_nogil = env.nogil
         env.nogil = 1
         TryFinallyStatNode.analyse_expressions(self, env)
@@ -4539,11 +4539,11 @@ class GILStatNode(TryFinallyStatNode):
         pass
 
     def generate_execution_code(self, code):
-        code.putln("/*with %s:*/ {" % self.state)
+        code.mark_pos(self.pos)
         if self.state == 'gil':
-            code.putln("PyGILState_STATE _save = PyGILState_Ensure();")
+            code.putln("PyGILState_STATE _save = PyGILState_Ensure();")
         else:
-            code.putln("PyThreadState *_save;")
+            code.putln("PyThreadState *_save;")
             code.putln("Py_UNBLOCK_THREADS")
         TryFinallyStatNode.generate_execution_code(self, code)
         code.putln("}")
@@ -5624,7 +5624,7 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb)
 
 #------------------------------------------------------------------------------------
 
-py23_init_threads_utility_code = UtilityCode(
+force_init_threads_utility_code = UtilityCode(
 proto="""
 #ifndef __PYX_FORCE_INIT_THREADS
 #if PY_VERSION_HEX < 0x02040200