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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
b5acfa47
Commit
b5acfa47
authored
Mar 15, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amend cpp test
parent
aa4de4f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
38 deletions
+42
-38
nogil_test/test_cpp.pyx
nogil_test/test_cpp.pyx
+42
-38
No files found.
nogil_test/test_cpp.pyx
View file @
b5acfa47
# distutils: language = c++
# distutils: language = c++
#cdef class biniou:
#cdef extern from "unistd.h" nogil:
# cdef int a
# unsigned int sleep(unsigned int seconds)
#
#cdef void genial(biniou arg):
# o = arg.a
# return
cdef
extern
from
"unistd.h"
nogil
:
cdef
cppclass
Rectangle
nogil
:
unsigned
int
sleep
(
unsigned
int
seconds
)
cdef
cypclass
Rectangle
:
int
a
int
a
void
test
():
void
test
():
this
.
a
+=
3
this
.
a
+=
3
void
test
(
int
a
):
void
test
(
int
a
):
this
.
a
+=
a
this
.
a
+=
a
void
Rectangle
(
int
a
):
void
Rectangle
(
int
a
):
this
.
a
=
a
this
.
a
=
a
void
Rectangle
():
void
Rectangle
():
this
.
a
=
3
this
.
a
=
5
Rectangle
__iadd__
(
Rectangle
other
)
nogil
:
# sleep(3)
cdef
cypclass
Rectangle_wrapper
(
Rectangle
):
Rectangle_wrapper
__iadd__
(
Rectangle_wrapper
other
):
return
this
return
this
Rectangle
__le__
(
Rectangle
other
)
nogil
:
Rectangle
_wrapper
__le__
(
Rectangle_wrapper
other
)
:
return
other
return
other
# void __dealloc__():
# sleep(5)
cdef
cypclass
Carre
(
Rectangle
):
cdef
cypclass
Carre
(
Rectangle_wrapper
):
int
b
int
b
void
__dealloc__
():
void
__dealloc__
():
sleep
(
3
)
pass
void
__init__
(
int
a
):
void
__init__
(
int
a
):
Rectangle
.
__init__
(
a
)
Rectangle
.
__init__
(
a
)
cdef
Rectangle
retour
()
nogil
:
void
test
():
cdef
Rectangle
o
=
Rectangle
(
12
)
this
.
a
+=
5
# o = Rectangle(12)
return
o
cdef
cypclass
Truc
(
Rectangle_wrapper
):
Carre
c
void
__init__
(
int
a
=
1
):
# Rectangle.__init__() is always called
this
.
c
=
Carre
(
a
)
void
__dealloc__
():
del
this
.
c
cdef
void
mange
(
Rectangle
o
)
nogil
:
cdef
cppclass
SomeMemory
(
Truc
)
nogil
:
cdef
int
a
=
o
.
a
int
d
return
cdef
int
tipo
()
nogil
:
cdef
int
tipo
()
nogil
:
#cdef Rectangle c
cdef
Carre
c
=
Carre
(
32
)
cdef
Rectangle
o
=
Rectangle
(
32
)
cdef
Truc
truc
=
Truc
()
#o = Rectangle(32)
c
=
o
truc
+=
c
c
=
Rectangle
(
3
)
c
+=
o
truc
.
c
.
Rectangle
.
test
()
return
c
.
a
#truc.c.test()
return
truc
.
c
.
a
def
toto
():
def
toto
():
print
(
tipo
())
print
(
tipo
())
#cdef void Rectangle::test() nogil:
# this.a += 3
#
#cdef void Rectangle::test(int a) nogil:
# this.a += a
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