Fix #528, x.conjugate() not available in nogil mode
authorRobert Bradshaw <robertwb@math.washington.edu>
Sun, 12 Dec 2010 04:59:48 +0000 (20:59 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sun, 12 Dec 2010 04:59:48 +0000 (20:59 -0800)
Cython/Compiler/PyrexTypes.py
tests/run/complex_numbers_T305.pyx

index 8d1ff54ef1b521847034d128a0fa2291643d3258..38df20ddf4dd55353f1cfeab2a4f411b505e4b6b 100755 (executable)
@@ -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)
index 6343ceb88e5032ee441050db81a3d24a3941851c..79a4938470aaba23b89fb1e36dc044a7f512ccce 100644 (file)
@@ -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"