Commit 21ffc32a authored by Boxiang Sun's avatar Boxiang Sun

Update test.pyx

parent 41521d00
...@@ -55,7 +55,7 @@ cdef class SomeMemory nogil: ...@@ -55,7 +55,7 @@ cdef class SomeMemory nogil:
""" """
self.a = self.b self.a = self.b
cdef void foo1(self, int a) nogil: cdef void foo1(self, double a) nogil:
""" """
It is possible to define native C/Cython methods It is possible to define native C/Cython methods
that release the GIL (cool...) that release the GIL (cool...)
...@@ -79,7 +79,7 @@ cdef class SomeMemory nogil: ...@@ -79,7 +79,7 @@ cdef class SomeMemory nogil:
# cdef bar(): # it is currently impossible to release GIL # cdef bar(): # it is currently impossible to release GIL
cdef int bar() nogil: # yet this is what we would like to cdef double bar() nogil: # yet this is what we would like to
""" """
This is a pure "cython method" which we would like to This is a pure "cython method" which we would like to
be able to declare with nogil option but this requires be able to declare with nogil option but this requires
...@@ -88,7 +88,7 @@ cdef int bar() nogil: # yet this is what we would like to ...@@ -88,7 +88,7 @@ cdef int bar() nogil: # yet this is what we would like to
cdef SomeMemory o = SomeMemory(42.0, 3.14) # for this we need class allocation to handle memory without libpython cdef SomeMemory o = SomeMemory(42.0, 3.14) # for this we need class allocation to handle memory without libpython
o.foo() # and we need method selection to be independent of libpython o.foo() # and we need method selection to be independent of libpython
o.foo1(2) o.foo1(2)
o.a = 1.0 o.a = 2.732
return o.a return o.a
cpdef baz(): cpdef baz():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment