From b779e54fc9361397171acb9c95abc2d7b97cd4c2 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 11 Dec 2010 20:59:48 -0800 Subject: [PATCH] Fix #528, x.conjugate() not available in nogil mode --- Cython/Compiler/PyrexTypes.py | 4 ++-- tests/run/complex_numbers_T305.pyx | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 8d1ff54e..38df20dd 100755 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -672,7 +672,7 @@ class CNumericType(CType): scope.directives = {} entry = scope.declare_cfunction( "conjugate", - CFuncType(self, [CFuncTypeArg("self", self, None)]), + CFuncType(self, [CFuncTypeArg("self", self, None)], nogil=True), pos=None, defining=1, cname=" ") @@ -1099,7 +1099,7 @@ class CComplexType(CNumericType): scope.declare_var("imag", self.real_type, None, "imag", is_cdef=True) entry = scope.declare_cfunction( "conjugate", - CFuncType(self, [CFuncTypeArg("self", self, None)]), + CFuncType(self, [CFuncTypeArg("self", self, None)], nogil=True), pos=None, defining=1, cname="__Pyx_c_conj%s" % self.funcsuffix) diff --git a/tests/run/complex_numbers_T305.pyx b/tests/run/complex_numbers_T305.pyx index 6343ceb8..79a49384 100644 --- a/tests/run/complex_numbers_T305.pyx +++ b/tests/run/complex_numbers_T305.pyx @@ -162,6 +162,11 @@ def test_conjugate_typedef(cdouble z): """ return z.conjugate() +cdef cdouble test_conjugate_nogil(cdouble z) nogil: + # Really just a compile test. + return z.conjugate() +test_conjugate_nogil(0) # use it + ## cdef extern from "complex_numbers_T305.h": ## ctypedef double double_really_float "myfloat" ## ctypedef float float_really_double "mydouble" -- 2.26.2