allow diverging nogil declaration, but only when assigning a nogil function to a...
authorStefan Behnel <scoder@users.berlios.de>
Thu, 5 Jun 2008 13:03:19 +0000 (15:03 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 5 Jun 2008 13:03:19 +0000 (15:03 +0200)
Cython/Compiler/PyrexTypes.py
tests/errors/nogilfunctype.pyx

index a9183fc7d721296ec99c5238c8ce8f70fbb32943..45346675092a215179fd23c50e151b90dd0b31af 100644 (file)
@@ -695,7 +695,7 @@ class CFuncType(CType):
             return 0
         if not self.same_calling_convention_as(other_type):
             return 0
-        if self.nogil != other_type.nogil:
+        if self.nogil and not other_type.nogil:
             return 0
         return 1
 
index 617ed829c59d009997306d8bae7f3ea7ea5d95b1..9b5580f09f70e458386af2306d8d6888b6be5fa4 100644 (file)
@@ -1,9 +1,14 @@
 cdef extern from *:
-    cdef void f() nogil
-    cdef void (*fp)()
+    cdef void f()
+    cdef void (*fp)() nogil
+
+    cdef void g() nogil
+    cdef void (*gp)()
+
+gp = g
 
 fp = f
 
 _ERRORS = u"""
-5:6: Cannot assign type 'void (void) nogil' to 'void (*)(void)'
+10:6: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
 """