Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
ebd34dcc
Commit
ebd34dcc
authored
Mar 13, 2019
by
gsamain
Committed by
Xavier Thompson
Jun 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reflect changes in nogil_extension test
parent
9cabf048
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
nogil_test/nogil_extension.pyx
nogil_test/nogil_extension.pyx
+11
-12
nogil_test/nogil_extension_test.py
nogil_test/nogil_extension_test.py
+3
-1
No files found.
nogil_test/nogil_extension.pyx
View file @
ebd34dcc
...
...
@@ -32,7 +32,7 @@ from libc.stdio cimport printf
# cdef class SomeMemory:
c
cdef
class
SomeMemory
:
c
def
cyp
class
SomeMemory
:
"""
This is a cdef class which is also called
a extensino type. It is a kind of C struct
...
...
@@ -46,30 +46,29 @@ ccdef class SomeMemory:
where all methods are "nogil" and memory
allocation does not depend on python runtime
"""
cdef
int
a
;
cdef
double
b
;
int
a
;
double
b
;
cdef
void
cinit
(
self
,
a
,
b
)
nogil
:
# self.a = a
# self.b = b
pass
void
__init__
(
int
a
,
double
b
):
this
.
a
=
a
this
.
b
=
b
cdef
void
cdealloc
(
self
):
void
__dealloc__
(
):
pass
cdef
void
foo1
(
self
):
void
foo1
(
):
"""
It is possible to define native C/Cython methods
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
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
# since we want this extension type is CPython free
...
...
nogil_test/nogil_extension_test.py
View file @
ebd34dcc
...
...
@@ -6,7 +6,9 @@ setup(
ext_modules
=
cythonize
([
Extension
(
'nogil_extension'
,
[
'nogil_extension.pyx'
],
language
=
'c++'
,
sources
=
[
'nogil_extension.pyx'
],
extra_compile_args
=
[
"-pthread"
,
"-std=c++11"
],
),
])
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment