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
Gwenaël Samain
cython
Commits
daad5d3e
Commit
daad5d3e
authored
Aug 16, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inplace side effect tests
parent
c7d6af72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
tests/run/inplace.pyx
tests/run/inplace.pyx
+27
-0
No files found.
tests/run/inplace.pyx
View file @
daad5d3e
...
@@ -16,6 +16,13 @@ __doc__ = u"""
...
@@ -16,6 +16,13 @@ __doc__ = u"""
>>> smoketest()
>>> smoketest()
10
10
>>> test_side_effects()
side effect 1
c side effect 2
side effect 3
c side effect 4
([0, 11, 102, 3, 4], [0, 1, 2, 13, 104])
"""
"""
def
f
(
a
,
b
):
def
f
(
a
,
b
):
...
@@ -83,3 +90,23 @@ def smoketest():
...
@@ -83,3 +90,23 @@ def smoketest():
print
a
.
buf
[
1
]
print
a
.
buf
[
1
]
stdlib
.
free
(
buf
)
stdlib
.
free
(
buf
)
def
side_effect
(
x
):
print
"side effect"
,
x
return
x
cdef
int
c_side_effect
(
int
x
):
print
"c side effect"
,
x
return
x
def
test_side_effects
():
a
=
range
(
5
)
a
[
side_effect
(
1
)]
+=
10
a
[
c_side_effect
(
2
)]
+=
100
cdef
int
i
cdef
int
b
[
5
]
for
i
from
0
<=
i
<
5
:
b
[
i
]
=
i
b
[
side_effect
(
3
)]
+=
10
b
[
c_side_effect
(
4
)]
+=
100
return
a
,
[
b
[
i
]
for
i
from
0
<=
i
<
5
]
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