Commit 7fa1b631 authored by gsamain's avatar gsamain

Reflect changes in nogil_extension test

parent 27e7c3ba
...@@ -32,7 +32,7 @@ from libc.stdio cimport printf ...@@ -32,7 +32,7 @@ from libc.stdio cimport printf
# cdef class SomeMemory: # cdef class SomeMemory:
ccdef class SomeMemory: cdef cypclass SomeMemory:
""" """
This is a cdef class which is also called This is a cdef class which is also called
a extensino type. It is a kind of C struct a extensino type. It is a kind of C struct
...@@ -46,30 +46,29 @@ ccdef class SomeMemory: ...@@ -46,30 +46,29 @@ ccdef class SomeMemory:
where all methods are "nogil" and memory where all methods are "nogil" and memory
allocation does not depend on python runtime allocation does not depend on python runtime
""" """
cdef int a; int a;
cdef double b; double b;
cdef void cinit(self, a, b) nogil: void __init__(int a, double b):
# self.a = a this.a = a
# self.b = b this.b = b
pass
cdef void cdealloc(self): void __dealloc__():
pass pass
cdef void foo1(self): void foo1():
""" """
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...)
""" """
self.a += 3 this.a += 3
cdef void foo2(self) nogil: void foo2():
""" """
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...)
""" """
self.a = 42 this.a = 42
# Not allowed to define pure Python function in the extension type with nogil option now # Not allowed to define pure Python function in the extension type with nogil option now
# since we want this extension type is CPython free # since we want this extension type is CPython free
......
...@@ -6,7 +6,9 @@ setup( ...@@ -6,7 +6,9 @@ setup(
ext_modules = cythonize([ ext_modules = cythonize([
Extension( Extension(
'nogil_extension', 'nogil_extension',
['nogil_extension.pyx'], language='c++',
sources=['nogil_extension.pyx'],
extra_compile_args=["-pthread", "-std=c++11"],
), ),
]) ])
) )
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