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
9572cd2d
Commit
9572cd2d
authored
Oct 08, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for reference count of called-on cypclass subscripts
parent
da3b60f3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
tests/run/cypclass_subscript_refcounting.pyx
tests/run/cypclass_subscript_refcounting.pyx
+45
-0
No files found.
tests/run/cypclass_subscript_refcounting.pyx
View file @
9572cd2d
...
...
@@ -8,6 +8,9 @@ cdef cypclass Value:
__dealloc__
(
self
)
with
gil
:
print
(
"Value destroyed"
)
int
foo
(
self
):
return
0
def
test_cpp_index_refcounting
():
"""
>>> test_cpp_index_refcounting()
...
...
@@ -58,3 +61,45 @@ def test_cyp_index_refcounting():
if
Cy_GETREF
(
a
)
!=
3
:
return
-
1
return
0
def
test_call_on_cpp_index_refcounting
():
"""
>>> test_call_on_cpp_index_refcounting()
Value destroyed
0
"""
cdef
vector
[
Value
]
vec
val
=
Value
()
vec
.
push_back
(
val
)
vec
[
0
].
foo
()
if
Cy_GETREF
(
val
)
!=
3
:
return
-
1
return
0
def
test_call_on_cyp_template_index_refcounting
():
"""
>>> test_call_on_cyp_template_index_refcounting()
Value destroyed
0
"""
v
=
Vector
[
Value
]()
val
=
Value
()
v
.
vec
.
push_back
(
val
)
v
[
0
].
foo
()
if
Cy_GETREF
(
val
)
!=
3
:
return
-
1
return
0
def
test_call_on_cyp_index_refcounting
():
"""
>>> test_call_on_cyp_index_refcounting()
Value destroyed
0
"""
v
=
ValueVector
()
val
=
Value
()
v
.
vec
.
push_back
(
val
)
v
[
0
].
foo
()
if
Cy_GETREF
(
val
)
!=
3
:
return
-
1
return
0
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