Error converting Pyrex file to C:
------------------------------------------------------------
...
cdef int f1():
   cdef int i = 0
   with gil:
  ^
------------------------------------------------------------

/u/dalcinl/tmp/gil2.pyx:3:3: undeclared name not builtin: gil


Of course, this one-line patch would enable it.

diff -r a0ebfe3b1cc2 Cython/Compiler/Parsing.py
--- a/Cython/Compiler/Parsing.py        Tue Mar 03 20:44:15 2009 +0100
+++ b/Cython/Compiler/Parsing.py        Thu Mar 05 20:54:59 2009 -0200
@@ -1363,8 +1363,7 @@
 def p_with_statement(s):
     pos = s.position()
     s.next() # 'with'
-#    if s.sy == 'IDENT' and s.systring in ('gil', 'nogil'):
-    if s.sy == 'IDENT' and s.systring == 'nogil':
+    if s.sy == 'IDENT' and s.systring in ('gil', 'nogil'):
         state = s.systring
         s.next()
         body = p_suite(s)


BTW, If the above is enabled, the following patch would be needed

diff -r a0ebfe3b1cc2 Cython/Compiler/Nodes.py
--- a/Cython/Compiler/Nodes.py  Tue Mar 03 20:44:15 2009 +0100
+++ b/Cython/Compiler/Nodes.py  Thu Mar 05 20:53:29 2009 -0200
@@ -4566,7 +4566,7 @@

     def generate_execution_code(self, code):
         if self.state == 'gil':
-            code.putln("PyGILState_Release();")
+            code.putln("PyGILState_Release(_save);")
         else:
             code.putln("Py_BLOCK_THREADS")


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to