From e6254033cda7eb5ac22b1239510b5a88909fb4cd Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 5 Jun 2008 15:03:19 +0200 Subject: [PATCH] allow diverging nogil declaration, but only when assigning a nogil function to a gil pointer --- Cython/Compiler/PyrexTypes.py | 2 +- tests/errors/nogilfunctype.pyx | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index a9183fc7..45346675 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -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 diff --git a/tests/errors/nogilfunctype.pyx b/tests/errors/nogilfunctype.pyx index 617ed829..9b5580f0 100644 --- a/tests/errors/nogilfunctype.pyx +++ b/tests/errors/nogilfunctype.pyx @@ -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' """ -- 2.26.2